Replies: 1 comment
-
Very much needed here too ! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi there!
We are using react-pdf in our application (thank you for this awesome tool!). We are eager to finally upgrade from v1 to v2, especially since issue #777 is now fixed. However there is one problem to solve before we can upgrade to v2.
We are using
onRender
function on<Document>
to auto-fit PDF to one page. How we use that in v1 is to get page count fromlayoutData
whichonRender
returns (layoutData.children.length
) and automatically reduce font-size and line-height until document fits to one page.In the new v2 onRender returns blob instead of data mentioned above. Therefore we need to find another way to get page count programatically. We tried a hacky solution (extract it from
blob.text()
), but this isn't an ideal solution and doesn't work for us since it is an async operation.What we would like to know if there is a method to get current page count for the document right after rendering it?
This question is pretty close to #1198, but I decided to create a new discussion since we only need the page count, not whole table of contents.
Thank you for your time!
Beta Was this translation helpful? Give feedback.
All reactions