I want to create a document, which has a big title-esque text field on the bottom. If I increase the y position just a bit further, it will be rendered on a new page despite having about 100pt left for the text to render. Is it possible to suppress overflow or violate the page margins?
const PDFDocument = require("pdfkit");
const fs = require("fs");
// Create a document
const doc = new PDFDocument({
size: "A4",
layout: "landscape",
});
doc.pipe(fs.createWriteStream("foo.pdf"));
// Actual Content
// Shapes
doc.rect(220.945, 50, 400, 400).stroke();
doc.rect(841.89 - 30 - 160, 50, 160, 50).stroke();
doc.rect(30, 50, 160, 50).stroke();
doc.rect(841.89 - 30 - 160, 595.28 - 250, 160, 50).stroke();
// Text
doc.fontSize(20).text("Field 1", 30, 97.64 + 35);
doc.fontSize(20).text("Field 2", 841.89 - (160 + 30), 97.64 + 35);
doc.fontSize(20).text("Field 3", 841.89 - (160 + 30), 400 + 97.64 - 75);
doc.fontSize(25).text("Placeholder for description",40,490,{
align: "center",
lineBreak: "false",
});
doc.end();
Is it possible to prevent text overflow?
Description
I want to create a document, which has a big title-esque text field on the bottom. If I increase the y position just a bit further, it will be rendered on a new page despite having about 100pt left for the text to render. Is it possible to suppress overflow or violate the page margins?
My code:
My environment