Add Margins to PDF Pages
Contents
[
Hide
]
Add margins to PDF pages
The Java sample adds 36-point margins to pages 1 and 3 of the source document.
Steps
- Create a
PdfFileEditorinstance. - Select the page numbers that should receive new margins.
- Call
addMarginswith the input file, output file, page list, and margin values. - Save the updated PDF.
Java example
public static void addMarginsToPdfPages(Path inputFile, Path outputFile) {
PdfFileEditor pdfEditor = new PdfFileEditor();
pdfEditor.addMargins(inputFile.toString(), outputFile.toString(), new int[] {1, 3}, 36, 36, 36, 36);
}