diegomura / react-pdf

📄 Create PDF files using React
https://react-pdf.org
MIT License
14.88k stars 1.18k forks source link

Form Fields Not Rendering in Password-Protected PDF Using react-pdf #2905

Open snrthn opened 2 weeks ago

snrthn commented 2 weeks ago

Describe the bug I am using react-pdf to render a password-protected PDF. While the main content is displayed correctly after providing the correct password, the form fields within the PDF document are not being rendered. These fields appear blank or are missing entirely, even though the rest of the document loads without issues. I suspect this might be an issue with how react-pdf or pdf.js handles certain types of form fields or encryption.

To Reproduce Steps to reproduce the behavior including code snippet (if applies):

  1. This is PDF file url: https://s3-hnapuhdd-cdn.didistatic.com/freight-h5/freight-h5/operation/cwwazbfn3Fj2.pdf?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKDD00000000000ISN17K4STMXMZJJ%2F20241013%2Fhnapuhdd%2Fs3%2Faws4_request&X-Amz-Date=20241013T172442Z&X-Amz-Expires=600&X-Amz-SignedHeaders=host&X-Amz-Signature=1bf7091481c0c741d9b41c1cc828962b1db3df076dd1bc5d4669726b47cc4151

  2. Use the following code snippet to render the PDF in react-pdf: https://code.meideng.dev/1728840893678955

  3. Render the component in your application.

  4. Notice that the form fields within the document are missing or blank, while the rest of the content renders correctly.

Expected behavior I expect the form fields (such as input fields, dropdowns, checkboxes, etc.) to be displayed and rendered correctly, just like the other text and images in the document. These fields should not be blank or missing.

Screenshots Show Normal: https://s3-gz01.didistatic.com/packages-mait/img/Hb3JGZ9XfB1728840738410.png Show Error: https://s3-gz01.didistatic.com/packages-mait/img/KcJ42EQDBi1728840753085.png

Desktop (please complete the following information):

abdoil commented 3 days ago

I think you are in the wrong repo, this one is for @react-pdf/renderer

The one you might be looking for is this one according to the code you provided.