-
-
Notifications
You must be signed in to change notification settings - Fork 885
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hidden canvas element may break layout #1815
Comments
Same issue here, and I confirmed this is related to the hidden Canvas element. Thanks for mentioning me, and please fix it. |
Roll back to |
Bump. The I was able to fix by adding the following style:
So far the text layer seems to be rendering fine. |
Before you start - checklist
Description
The text layer functionality of pdf.js produces a hidden canvas element:
pdf.js includes CSS (see here) to ensure that this doesn't interfere with the layout. However, this CSS is not included in react-pdf's
TextLayer.css
. Without it, displaying PDFs including a text layer may break the layout (see "Steps to reproduce").As a workaround, one can include the linked CSS directly, but I guess it would make sense to include it in
TextLayer.css
.Steps to reproduce
Create a React app (with root element
#root
) and include e.g. this CSS:Then render a PDF with react-pdf and observe that the
<body>
has height greater than the intended100vh
, which is due to the hidden canvas element.Expected behavior
The hidden canvas element should not affect the layout.
Actual behavior
The hidden canvas element causes additional vertical space.
Additional information
No response
Environment
The text was updated successfully, but these errors were encountered: