folder2pdf
Convert a folder's contents (and its sub-folders) into a single PDF document.
Text and source-code files are included as readable content; image files are embedded with captions.
The output is useful for AI ingestion tools like NotebookLLM.
Installation
pip install folder2pdf
Usage
folder2pdf <folder> [<folder> ...] [options]
Arguments
| Argument | Description |
|---|---|
folder |
One or more folder paths to convert. |
Options
| Option | Description |
|---|---|
-o, --output OUTPUT |
Destination PDF file path (default: output.pdf). |
--no-images |
Do not embed image files in the PDF. |
-e, --extensions EXT [EXT ...] |
Whitelist of file extensions to include, e.g. .py .md .txt. When omitted, built-in defaults are used. |
-b, --blacklist PATTERN [PATTERN ...] |
Glob patterns (gitignore-style) for files or directories to exclude, e.g. tests/ *.log secret.txt. |
--no-gitignore |
Do not read or apply the .gitignore file found in the target folder. |
--max-chars N |
Truncate each text file at N characters and append a notice. |
--no-empty-files |
Skip text files that are empty (zero bytes). |
--max-lines N |
Truncate each text file at N lines and append a notice. Takes precedence over --max-chars when both are provided. |
Examples
Convert a folder to PDF:
folder2pdf ./my-project -o my-project.pdf
Convert multiple folders into one PDF:
folder2pdf ./backend ./frontend -o project.pdf
Convert without images:
folder2pdf ./my-project -o my-project.pdf --no-images
Only include Python and Markdown files:
folder2pdf ./my-project -o my-project.pdf -e .py .md
Exclude test files and log files:
folder2pdf ./my-project -o my-project.pdf -b "tests/" "*.log"
Ignore .gitignore rules:
folder2pdf ./my-project -o my-project.pdf --no-gitignore
Skip empty files and limit output to 200 lines per file:
folder2pdf ./my-project -o my-project.pdf --no-empty-files --max-lines 200
Truncate each file at 5000 characters:
folder2pdf ./my-project -o my-project.pdf --max-chars 5000
What gets included
Text / source-code files (default extensions):
.txt .md .rst .csv .tsv .json .xml .yaml .yml .toml
.ini .cfg .conf .env .log .py .js .ts .jsx .tsx
.html .htm .css .scss .java .c .cpp .h .hpp .cs
.go .rs .rb .php .sh .bash .zsh .ps1 .bat .sql and more.
Image files (embedded with captions):
.png .jpg .jpeg .gif .bmp .webp .tiff
Skipped automatically:
- Hidden files and directories (names starting with
.) - Files matched by the
.gitignorein the target folder (requirespathspec) - Files matched by the
--blacklistpatterns - Binary files without a recognised extension
Project Summary (cover page)
The generated PDF cover page includes a Project Summary section with:
- Total Files Processed – number of files included
- Total Lines of Code – combined line count across all text files
- Image Files – number of image files embedded
- Lines by Extension – per-extension line counts, sorted by descending count
Programmatic API
from folder2pdf.converter import convert
pdf_path = convert(
folder="./my-project",
output="my-project.pdf",
include_images=True,
extensions=None, # None = use built-in defaults
blacklist=["tests/", "*.log"], # optional exclusion patterns
use_gitignore=True, # read & apply .gitignore in the folder
no_empty_files=True, # skip zero-byte text files
max_lines=200, # truncate each text file at 200 lines
)
print(f"PDF saved to {pdf_path}")
Dependencies
Metadata
Release files for folder2pdf 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| folder2pdf-0.1.3.tar.gz | 19.0 kB | With provenance | Details for folder2pdf-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| folder2pdf-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for folder2pdf-0.1.3-py3-none-any.whl |
Total release size: 34.2 kB
Release files / folder2pdf-0.1.3.tar.gz
| Download URL | folder2pdf-0.1.3.tar.gz |
|---|---|
| Size | 19.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0bcca0964ef212837b9b8f5bbc98fa737d06dd9795599a6b2aebc186e82ebb82
|
|
BLAKE2b-256 checksum How to use checksums |
1d9475102d7a2ca33ca025cb03b5fe4264dbf4595079886a0fd57440544c96a4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 13, 2026.
Transparency logRelease files / folder2pdf-0.1.3-py3-none-any.whl
| Download URL | folder2pdf-0.1.3-py3-none-any.whl |
|---|---|
| Size | 15.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cb6bfc11154ada8e7107f4264a3a692b04d7e872c6bd000604f1b8beac846782
|
|
BLAKE2b-256 checksum How to use checksums |
83accc3089d18cc79ed19b7e72cad982b8e46007bb2de871a62294cd8c4a5d7f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 13, 2026.
Transparency logSecurity for folder2pdf 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for folder2pdf-0.1.3.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 13, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.