Add Page Breaks in PDF
Contents
[
Hide
]
Add page breaks in a PDF
Use this workflow when a page needs to be split into multiple pages at a known Y position.
Steps
- Create a
PdfFileEditorinstance. - Build one or more
PdfFileEditor.PageBreakentries with the page number and break position. - Pass the page break array to
addPageBreak. - Save the updated PDF document.
Java example
public static void addPageBreaksInPdf(Path inputFile, Path outputFile) {
PdfFileEditor pdfEditor = new PdfFileEditor();
pdfEditor.addPageBreak(inputFile.toString(), outputFile.toString(), new PdfFileEditor.PageBreak[] {
new PdfFileEditor.PageBreak(1, 400)
});
}