Other utilities⚓︎
PyPDFForm offers additional utilities similar to other PDF libraries.
This section of the documentation uses this PDF as an example.
Blank PDFs⚓︎
Use the BlankPage class with PdfWrapper to create blank PDFs.
The following example generates a PDF with a single blank page:
By default, BlankPage creates a letter-size blank page (612 x 792 points, or 8.5 x 11 inches). To change the dimensions, specify width and height in points:
Extract pages⚓︎
Warning
Extracted pages keep links within the same page. Links to other pages are removed, even when those pages are extracted together.
The PdfWrapper object has a .pages attribute, which is a PdfArray containing one PdfWrapper object per page:
Merge multiple PDFs⚓︎
Note
When merging PDF forms with duplicate field names, PyPDFForm automatically renames conflicting fields by appending a unique, randomly generated suffix. This means some field names in the merged PDF will differ from their original names.
To avoid automatic renaming, give duplicate fields unique names across all input PDFs before merging. See Change field name.
You can merge multiple PDF files by adding their PdfWrapper objects together. For example, to merge this PDF and this PDF:
When merging a large number of PDF files, use the PdfArray.merge method for better performance. It always returns a new PdfWrapper, which is empty when the array is empty:
For CLI merges, pass the input PDFs to create merge:
Change PDF version⚓︎
PyPDFForm allows you to set the PDF version to any supported value up to 2.0: