react-pdf icon indicating copy to clipboard operation
react-pdf copied to clipboard

Duplicated Annotation Layer - after update to version 9.0

Open karinaglf opened this issue 1 week ago • 0 comments

Before you start - checklist

  • [X] I followed instructions in documentation written for my React-PDF version
  • [X] I have checked if this bug is not already reported
  • [X] I have checked if an issue is not listed in Known issues
  • [X] If I have a problem with PDF rendering, I checked if my PDF renders properly in PDF.js demo

Description

After upgrading to react-pdf 9.0.0, we have encountered an issue where some form field inputs seem to be displayed twice. This duplication results in incorrect rendering of these fields. It appears that hidden elements from the Annotation layer are being shown, causing this duplication. Please see the image below for reference.

screen

Steps to reproduce

  • Use react-pdf version 9.0.0.
  • Render a PDF document that includes textWidgetAnnotation elements.
  • Set Page props with renderAnnotationLayer to true and renderForms to false
  • Set the worker setup for legacy browser, as below:
pdfjs.GlobalWorkerOptions.workerSrc = new URL(
	'pdfjs-dist/legacy/build/pdf.worker.min.mjs',
	import.meta.url,
).toString();

Expected behavior

  • Form fields and Annotation Layer should be rendered correctly.

Actual behavior

  • Rendering of elements with the textWidgetAnnotation class is off.
  • These elements are displayed in the viewer despite having the hidden attribute.
  • When renderForm is set to true, the duplication issue is resolved, but some form fields, such as checkboxes, appear with incorrect styles.

Additional information

No response

Environment

  • Browser (if applicable): Chrome, Firefox
  • React-PDF version: 9.0.0
  • React version: 16
  • Bundler name and version (if applicable): webpack v 5.92.1

karinaglf avatar Jun 27 '24 16:06 karinaglf