doctools#

PDF utilities for extracting images and compressing PDFs.

matviz.doctools.compress_pdf_images(input_pdf_path: str, output_pdf_path: str, dpi: int = 150, quality: int = 40) str[source]#

Compresses all images in the PDF by rendering pages as compressed images. Returns the path to the compressed PDF.

dpi: controls the resolution of the page rendering. quality: JPEG quality setting (0-100).

matviz.doctools.extract_images_from_pdf(input_pdf_path: str, output_folder: str) str[source]#

Extracts all images from the given PDF and saves them in the specified output folder. Returns the path to a zipped folder containing all extracted images.