Nano-PDF is a command-line interface (CLI) tool that empowers users to edit PDF slides and documents using natural language prompts. Powered by Google's Gemini 3 Pro Image (also known as 'Nano Banana') model, it can perform tasks like updating charts, fixing typos, and adding new slides while preserving the PDF's searchable text layer through OCR re-hydration. The current version is 0.2.1, with recent updates indicating active development and a focus on incremental improvements.
pip install nano-pdfNo compatibility data collected yet for this library.
Nano-PDF is primarily a CLI tool. This quickstart demonstrates how to install its system dependencies, configure your Google Gemini API key, and perform basic PDF editing or slide generation using natural language commands.
Install Poppler and Tesseract for your operating system (e.g., `brew install poppler tesseract` on macOS, `sudo apt-get install poppler-utils tesseract-ocr` on Ubuntu/Debian, `choco install poppler tesseract` on Windows). Restart your terminal after installation.
Obtain a Google Gemini API key from Google AI Studio and ensure billing is enabled on your Google Cloud project. Set the key as an environment variable: `export GEMINI_API_KEY="your_key_here"`.
If results appear on an unexpected page, try adjusting the page number by one (e.g., if page 1 doesn't work, try page 0 or page 2). Always sanity-check the output PDF.
For best results, try increasing the `--resolution` to '4K' (though this might slow down processing). Be aware that OCR is not always perfect.
To speed up processing, consider using lower `--resolution` settings like '2K' or '1K'. For large documents, breaking edits into smaller, targeted commands might also help.
Install Poppler and Tesseract specific to your operating system. For macOS: `brew install poppler tesseract`. For Ubuntu/Debian: `sudo apt-get install poppler-utils tesseract-ocr`. For Windows: `choco install poppler tesseract`. Afterwards, restart your terminal. You can verify installation by running `which pdftotext` and `which tesseract`.
Set the API key as an environment variable before running the command: `export GEMINI_API_KEY="your_key_here"`. On Windows, use `set GEMINI_API_KEY=your_key_here` in cmd or `$env:GEMINI_API_KEY='your_key_here'` in PowerShell. For persistent storage, consider adding it to your shell's profile file (e.g., `.bashrc`, `.zshrc`) or using a `.env` file with `python-dotenv`.
Access Google AI Studio, ensure your project has billing enabled, and generate an API key from an account with a paid billing tier.
Use the `--style-refs` option to specify reference pages that have the desired visual style. For example, `--style-refs "1,5"` will tell the model to analyze pages 1 and 5 for styling cues.
Ensure your generated images are high resolution by using the `--resolution "4K"` option. While OCR may not be perfect, higher resolution generally improves accuracy.