Skip to main content

Count PDF Page

A Python package for counting pages in PDF files and generating detailed markdown reports.

Features

  • 📄 Count pages in individual PDF files or entire directories
  • 📊 Generate comprehensive markdown reports with statistics
  • 🖥️ Command-line interface for easy usage
  • 🐍 Python API for programmatic use
  • 📈 Detailed statistics including average, largest, and smallest files

Installation

From PyPI (when published)

pip install count-pdf-page

From Source

git clone https://github.com/yourusername/count-pdf-page.git
cd count-pdf-page
pip install -e .

Usage

Command Line Interface

Count PDF pages in the current directory:

count-pdf-page

Count PDF pages in a specific directory:

count-pdf-page /path/to/pdf/directory

Specify custom output file:

count-pdf-page --output my_report.md

Enable verbose output:

count-pdf-page --verbose

Python API

from count_pdf_page import count_pdf_pages, process_directory, generate_markdown_report

# Count pages in a single PDF
page_count = count_pdf_pages("document.pdf")
print(f"Pages: {page_count}")

# Process entire directory
results, total_pages = process_directory("/path/to/pdfs")

# Generate markdown report
report = generate_markdown_report(results, total_pages)
print(report)

Requirements

  • Python 3.7+
  • PyPDF2

Development

Setup Development Environment

git clone https://github.com/yourusername/count-pdf-page.git
cd count-pdf-page
pip install -e ".[dev]"

Run Tests

pytest

Code Formatting

black src tests

Type Checking

mypy src

Output Example

The generated markdown report includes:

  • Summary with total files and pages
  • Detailed table of all PDF files and their page counts
  • Statistics including average pages, largest file, and smallest file
  • Timestamp of report generation

License

MIT License - see LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Changelog

0.1.0

  • Initial release
  • Basic PDF page counting functionality
  • Command-line interface
  • Markdown report generation
  • Python API

Metadata

Release files for count-pdf-page 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for count-pdf-page 0.1.1
File Size Uploaded
count_pdf_page-0.1.1.tar.gz 6.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for count-pdf-page 0.1.1
File Interpreter ABI Platform
count_pdf_page-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 13.3 kB

Release files / count_pdf_page-0.1.1.tar.gz

Download URL count_pdf_page-0.1.1.tar.gz
Size 6.8 kB
Tags Source
SHA-256 checksum
How to use checksums
b5316da8b46aa88896c27fcb14474789db5c5f37c7d478353ed6de2dd6ba9bae
BLAKE2b-256 checksum
How to use checksums
23f01d1f6af14b0d1828d4273f4e09b878f3a42996a79a66b27590fb02286ce9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.23

Release files / count_pdf_page-0.1.1-py3-none-any.whl

Download URL count_pdf_page-0.1.1-py3-none-any.whl
Size 6.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d49821aa27727fe1b5728f89fff73b5bf9051c87e4ddc467db63cb0e82be56b2
BLAKE2b-256 checksum
How to use checksums
bfd5b6f2074017f2a101ae084d4ad7bf0237bb6bd8afc8f84d6aaf05c843c754
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.23

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page