A beautiful web application for converting Jupyter notebooks (.ipynb) to professionally formatted PDFs with full LaTeX support.
- Beautiful PDFs - Clean, professional formatting with elegant typography
- Full LaTeX Support - Complete mathematical equation and notation rendering
- Syntax Highlighting - Beautiful code highlighting with proper formatting
- Customizable Settings - Control page layout, fonts, code themes, and content inclusion
- Preset Templates - Pre-configured settings for academic papers, lab reports, and minimal outputs
- Modern UI - Built with Next.js, React, and Tailwind CSS
- Drag & Drop - Easy file upload with drag-and-drop support
- Fast Conversion - Efficient server-side processing with rate limiting
Before running this application, ensure you have the following installed:
-
Node.js (v18 or higher)
- Download from nodejs.org
-
Python 3 (v3.8 or higher)
- Download from python.org
-
Pandoc (required for notebook conversion)
macOS:
brew install pandoc
Ubuntu/Debian:
sudo apt-get install pandoc
Windows:
- Download and install from pandoc.org
-
LaTeX Distribution (required for PDF generation)
Choose one based on your operating system:
macOS:
# Using Homebrew brew install --cask mactex-no-gui # Or download MacTeX from: https://www.tug.org/mactex/
Ubuntu/Debian:
sudo apt-get update sudo apt-get install texlive-xetex texlive-fonts-recommended texlive-plain-generic
Windows:
-
Clone the repository (or navigate to the project directory)
cd ipynb2pdf -
Install Node.js dependencies
npm install
-
Install Python dependencies
pip install -r requirements.txt
Or using a virtual environment (recommended):
python3 -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate pip install -r requirements.txt
-
Verify installations
# Check if Pandoc is available pandoc --version # Check if pdflatex is available pdflatex --version
-
Start the development server
npm run dev
-
Open your browser
- Navigate to http://localhost:3000
-
Upload a notebook
- Drag and drop a
.ipynbfile onto the upload area - Or click to browse and select a file
- The PDF will automatically download once conversion is complete
- Drag and drop a
-
Build the application
npm run build
-
Start the production server
npm start
-
Access the application
ipynb2pdf/
├── app/
│ ├── api/
│ │ └── convert/
│ │ └── route.ts # API endpoint for conversion
│ ├── globals.css # Global styles
│ ├── layout.tsx # Root layout
│ └── page.tsx # Home page
├── components/
│ └── NotebookUploader.tsx # Upload component
├── python/
│ ├── templates/
│ │ └── custom.tplx # Custom LaTeX template
│ └── convert.py # Python conversion script
├── temp/ # Temporary files (auto-generated)
│ ├── uploads/ # Uploaded notebooks
│ └── outputs/ # Generated PDFs
├── requirements.txt # Python dependencies
└── package.json # Node.js dependencies
- Frontend: User uploads a
.ipynbfile through the React/Next.js interface - API Route: Next.js API route receives the file and validates it
- Python Script: Calls the Python conversion script with nbconvert
- LaTeX Processing: nbconvert uses LaTeX to generate a beautifully formatted PDF
- Download: The PDF is returned to the user and automatically downloads
- Ensure Python 3 is installed and accessible via
python3command - Install Python dependencies:
pip install -r requirements.txt
- Verify Pandoc is installed:
pandoc --version - Verify LaTeX is installed:
pdflatex --version - Check that all Python packages are installed correctly
- Ensure the notebook file is valid JSON
- If using a virtual environment, make sure it's activated
- Maximum file size is 10MB
- Consider splitting large notebooks into smaller files
- Large or complex notebooks may take time to process
- Simplify the notebook or reduce the number of cells
Edit app/api/convert/route.ts:
const MAX_FILE_SIZE = 10 * 1024 * 1024; // Change to desired size in bytesEdit the LaTeX template in python/templates/custom.tplx to customize:
- Page margins and geometry
- Font styles and sizes
- Code highlighting colors
- Header and footer styles
The application provides extensive customization through the settings panel:
- Page size (A4, Letter, Legal, A3)
- Orientation (Portrait, Landscape)
- Margins (Narrow, Normal, Wide)
- Body font (Serif, Sans-Serif, Computer Modern)
- Code font (Fira Code, Source Code Pro, Courier)
- Font size (10pt, 11pt, 12pt)
- Syntax highlighting themes (GitHub, Monokai, Solarized, Dracula, Nord)
- Line numbers toggle
- Input/Output prompt display
- Table of contents generation
- Page numbers and positioning
- Section numbering
- Include/exclude code cells
- Include/exclude cell outputs
- Include/exclude markdown cells
- Frontend: Next.js 16, React 19, TypeScript
- Styling: Tailwind CSS 4
- File Upload: react-dropzone
- Backend: Next.js API Routes with rate limiting
- PDF Conversion: Python nbconvert with custom LaTeX processing
- LaTeX: XeLaTeX with custom templates for professional formatting
Contributions are welcome! Please feel free to submit issues or pull requests.
MIT License - feel free to use this project for any purpose.
If you encounter any issues:
- Check the troubleshooting section above
- Ensure all prerequisites are properly installed
- Verify your notebook file is valid JSON
- Check the console/terminal for error messages
Built using Next.js and nbconvert