Texts are always inserted into new pages after the 2nd page.
See original GitHub issueThe following code snippets will generate a PDF file with 931 pages. The first page has y=0
to y=69
. Starting from y=70
, each line is printed on another page.
const fs = require('fs');
const PDFDocument = require('pdfkit');
const doc = new PDFDocument({
size: 'A4',
margin: 0
});
const stream = doc.pipe(fs.createWriteStream('./test/test.pdf'));
stream.on('finish', function() {
process.exit();
});
doc.fontSize(12);
for (let y = 0; y < 1000; y++) {
doc.text(`Line=${y}: doc_pos=(${doc.x}, ${doc.y});specified_pos=(10, ${y*12})`, 10, y * 12);
}
doc.end();
This is how it looks likes.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:11
Top Results From Across the Web
How to Stop Next Page Content from Moving When Adding ...
Step 1. Click in the document where the text on one page ends. The cursor should insert before the next page to keep...
Read more >How do I prevent text from moving down on page 2 when ...
I want the text on page 2 at the top of the page to stay put and not move down. I have a...
Read more >Link text boxes in Pages on Mac - Apple Support
You can link two or more text boxes so that text can flow from one text box to the next. For example, if...
Read more >How to Stop Paragraphs from Splitting Between Pages in Word
... pages in Word, it's best to use the Keep with next or Keep lines together paragraph formats rather than inserting manual page...
Read more >310. Why does my text wrap to the next line before reaching ...
This happens if you accidentally change the paragraph indentation for the document. ... Ensure that Indentation, both before and after text, are set...
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
Sorry @rahim3070 . It has been too long since I raised this and I cannot find what I have done. The idea was to control the pages by yourself. When the content is too large to fit in the page, call
doc = doc.addPage()
and the remaining content will be rendered on the new page.Dear @xtu, I meant your complete code sample what you have done, please