The script provided is a Python program that analyses a PDF file to find pages that contain colours other than black in both text and images. See below for detailed information on how the script works.
The script requires the following Python library:
fitz: This library provides an interface for working with PDF files using the Poppler library.
Make sure you have installed all the necessary dependencies before running the script.
Install using: pip install PyMuPDF
This function checks whether a specific page contains colors other than black in both text and images. It returns True if colors other than black are found, otherwise it returns False.
Arguments
page: An object representing the PDF page to be analyzed.
This function finds and returns the pages in the PDF file that contain colors other than black in both text and images.
Arguments
pdf_path: The path of the PDF file to be analyzed.
Returns
The function returns a list of page numbers corresponding to the pages in the PDF file that contain colors other than black.
FileNotFoundError: Raised if the specified PDF file path does not exist.
When the script is run, the user is prompted for the path to the PDF file to be analysed. The script will then print the pages in the PDF file that contain colours other than black, along with the total number of coloured pages.
Note: The script uses the fitz interface to work with PDF files using the Poppler library. Make sure you have Poppler installed and configured correctly on your system.
Poppler Documentation: https://poppler.freedesktop.org/documentation.html
fitz Documentation: https://pymupdf.readthedocs.io/