Skip to content

MatteoAngelinelli/colorsinpdf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

ColorsInPDFPages

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.

Dependencies

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

Functions

has_color(page)

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.

find_colored_pages(pdf_path)

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.

Exceptions

FileNotFoundError: Raised if the specified PDF file path does not exist.

Usage

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.

Additional Resources:

Poppler Documentation: https://poppler.freedesktop.org/documentation.html

fitz Documentation: https://pymupdf.readthedocs.io/

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages