-
Notifications
You must be signed in to change notification settings - Fork 530
How To Convert to PDF
A new feature introduced with PyMuPDF v1.13.3 and extended in v1.13.4, is conversion of arbitrary documents to PDF.
This works using method Document.convertToPDF(from_page=0, to_page=-1, rotation=0)
. The parameters control the input page range and sequence, and page rotation.
If from_page > to_page >= 0
, page sequence is reversed. Default parameters will convert the complete document.
The result is a Python bytes
object. Open it as a new PyMuPDF PDF document, or save it to disk using the ".pdf" file extension.
- Image files (raster) are fully supported.
- XPS, EPUB, CBZ files work very well, too. Other types like FB2 should also work. See demo script xps-converter.py.
- SVG images do also work (inaccuracies in some cases).
- You cannot change an XPS with MuPDF. But you can convert it to PDF and then change that.
- See above demo script.
- Batch-convert images to PDF documents.
HOWTO Button annots with JavaScript
HOWTO work with PDF embedded files
HOWTO extract text from inside rectangles
HOWTO extract text in natural reading order
HOWTO create or extract graphics
HOWTO create your own PDF Drawing
Rectangle inclusion & intersection
Metadata & bookmark maintenance