Generating two blank pages
See original GitHub issueDescribe the bug When i try to generate a pdf file on browser, the content of my file are two blank pages, no matter what i try to put inside.
To Reproduce This is the code what i call to generate
<PDFDownloadLink document={<RelFatura dados={this.state.excel} titulo={'Voucher a faturar'} />} fileName="Vouchers.pdf">
{({ blob, url, loading, error }) => (loading ? <i className="fa fa-file-pdf-o"> Loading document...</i> : <i className="fa fa-file-pdf-o"> Gerar pdf </i>)}
</PDFDownloadLink>
this is my RelFatura
export const RelFatura = (props) => (
<Document>
<Page size="A4" style={styles.page}>
<Text style={styles.text}> hi</Text>
</Page>
</Document>
);
and these are my styles
const styles = StyleSheet.create({
page: {
paddingTop: 35,
paddingBottom: 65,
paddingHorizontal: 35,
paddingRight: 35,
},
text: {
margin: 10,
fontSize: 12,
textAlign: 'justify',
fontFamily: 'Times-Roman'
}
});
i have two pages that use the pdf generator, in one of them he works perfectly i take the RelFatura and put there where it is working and the output was what i expected ( the page with hi written ) but in the other page he give the blank page bug, i try put the same code on both pages nevertheless it did the same bug (one of them still working and the other give me the bug)
Expected behavior A single page with hi written
Screenshots
Desktop (please complete the following information):
- OS: Ubuntu, Windows
- Browser: chorme
- React-pdf version: 1.4.0
Issue Analytics
- State:
- Created 5 years ago
- Reactions:8
- Comments:9
Top Results From Across the Web
How do I insert double blank pages - LaTeX Stack Exchange
Depending on what you're actually trying to do, I'd use \cleardoublepage . You should just be able to add another \newpage in the...
Read more >How to Add Blank Page in Microsoft Word - YouTube
How to add a blank page in Microsoft Word? In this tutorial, I show you how to add a blank page to a...
Read more >Adding and Removing Blank Pages - Atticus
Begin on Right Side of Page. One of the most common reasons for adding a blank page is to have the first page...
Read more >blank pages appearing as page numbers added to document
Use INSERT tab to add two blank pages in front of the text for the TOC and the LOF; Precede each chapter header...
Read more >How to Insert and Delete a Blank Page in Microsoft Word (PC ...
Select Blank Page in the Pages group. Blank Page button in Word 365. Figure 2. Blank Page button. Your blank ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I was facing the same issue with the PDFDownloadLink Component. Thanks to the suggestions above, I was able to figure a solution out and resolved it by memoizing it with React’s hook
useMemo
I think the documentation should mention this behavior more clearly as it’s confusing.
This was happening to me due to my component triggering a re-render from a state change before my document viewer was finished mounting. This happened because the state change happened on mount.
this can be fixed by making sure your PDF viewer has everything it needs before its initial render: