'How to add styles to react-pdf Document
I tried with this code and cannot adjust the width
<Document style={{width:"100px"}} file="123.pdf" onLoadSuccess={onDocumentLoadSuccess} > <Page pageNumber={pageNumber} /> </Document>
Solution 1:[1]
style={{}} was not working. react-pdf has no width property. But there was a height property. I used that and according to ratio it adjusted the width as well. It worked for me.
Solution 2:[2]
According to the documentation https://react-pdf.org/components does not support style, you need to style the page component
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Rahal Athukorala |
Solution 2 | Juan Patrono |