Package Functions
- pdf_manipulation.convert2pdf(input_dir: str, output_dir: str, merged_filename: str, enhance_img: bool = False, delete_processed_images: bool = False, delete_temp_pdfs: bool = False) None[source]
Convert images in a folder to PDFs and merge them into a single PDF file. Optionally enhance the images by converting to greyscale and filtering lower values before conversion.
- Args:
input_dir (str): Folder containing images to convert to PDFs.
output_dir (str): Folder to save the converted PDFs and the merged PDF file.
merged_filename (str): Name of the merged PDF file.
enhance_img (bool): Enhance the images before conversion. Default is False.
delete_processed_images (bool): Delete the processed images after conversion. Default is False.
delete_temp_pdfs (bool): Delete the temporary PDF files after merging. Default is False.
- Returns:
None
- pdf_manipulation.convert2pdf_with_order(input_list: list, output_dir: str, merged_filename: str, enhance_img: bool = False)[source]
Convert a list of images to PDFs and merge them in the order of the list. Optionally enhance the images by converting to greyscale and filtering lower values before conversion.
- Args:
input_list (list): List of image filenames to convert to PDFs.
output_dir (str): Folder to save the converted PDFs and the merged PDF file.
merged_filename (str): Name of the merged PDF file.
enhance_img (bool): Enhance the images before conversion. Default is False.
- Returns:
None
- pdf_manipulation.enhance_image(image_path: str, output_path: str) ndarray[source]
Enhance an image by converting to greyscale, denoising, and thresholding.
- Args:
image_path (str): Path to the image file.
output_path (str): Path to save the enhanced image.
- Returns:
np.ndarray: Enhanced image as a NumPy array.
- pdf_manipulation.enhance_images(input_dir: str, output_dir: str) None[source]
Enhance all images in a folder by converting to greyscale, denoising, and thresholding.
- Args:
input_dir (str): Folder containing images to enhance.
output_dir (str): Folder to save the enhanced images.
- Returns:
None
- pdf_manipulation.merge_pdfs(input_folder: str, output_folder: str, merged_filename: str) None[source]
Merge all PDFs in a folder into a single PDF file. Order is determined by the sorting in the OS.
- Args:
input_folder (str): Folder containing PDF files to merge.
output_folder (str): Folder to save the merged PDF file.
merged_filename (str): Name of the merged PDF file.
- Returns:
None
- pdf_manipulation.merge_pdfs_in_order(files_list: list, output_folder: str, merged_filename: str) None[source]
Merge PDFs in a list into a single PDF file. Order is determined by the order of the list.
- Args:
files_list (list): List of PDF filenames to merge.
output_folder (str): Folder to save the merged PDF file.
merged_filename (str): Name of the merged PDF file.
- Returns:
None
- pdf_manipulation.pdf_splitter(path: str, out_dir: str, start_page: int, end_page: int) None[source]
Split a PDF file into multiple PDF files based on the start and end page numbers.
- Args:
path (str): Path to the PDF file.
out_dir (str): Folder to save the split PDF files.
start_page (int): Start page number.
end_page (int): End page number.
- Returns:
None