Why in pdfkit, a string starts a new paragraph and a new page

349 Views Asked by At

I'm using pdfKit and I'm drawing some lines and text on a single page. It works nice, but if I wrote the text near the border the string is cut off and a new page is created!

Here the code:

const PDFDocument = require('pdfkit');
const doc = new PDFDocument;
doc.fontSize(12).text("v.v0a.0.4", 500, 710);

The result is a page break!

enter image description here

Why I can draw a line near the margin but the text break the page?

Thanks for any suggestion!

1

There are 1 best solutions below

0
On

The solution is into the options!

const doc = new PDFDocument({
        "margin":0
     }
  )