pdf#
Add docs here.
Module documentation#
pdf manipulation facilities.
- easely.pdf.page_size(file_path: str | Path, page_number: int = 0) Tuple[float, float][source]#
Return the page size for a given page of a given pdf document.
Arguments#
- file_pathPathLike
The path to the input pdf file.
- page_numberint
The target page number (starting from zero).
Returns#
- Tuple[float, float]
The page size, as a tuple of (width, height).
- easely.pdf.run_imagemagick(input_file_path: str | Path, output_file_path: str | Path, target_width: int, compression_level: int = 0) Path[source]#
Convert a .pdf file to a .png file using imagemagick convert under the hood.
Note the convert command is deprecated in IMv7 in favor of magick or magick convert.
See https://imagemagick.org/script/command-line-options.php for some basic information about convert’s internals.
Arguments#
- input_file_pathPathLike
The path to the input pdf file.
- output_file_pathPathLike
The path to the output rasterized (png) file.
- target_widthint
The target width for the output png file in pixels.
- compression_levelint, optional
The PNG compression level to be passed to convert. Levels range from 0 (no compression, fastest) to 9 (maximum compression, slowest). Note the compression only affects size, not image quality.