Notebook2PDF is a completely local, zero-server web application designed to convert Jupyter Notebooks (.ipynb) into perfectly formatted PDF documents.
It was built to solve a common problem in academic and research environments: native Jupyter PDF exports often require massive LaTeX installations and frequently fail to wrap long lines of code, resulting in cut-off text on printed assignments. Notebook2PDF handles line wrapping, math rendering, and layout formatting instantly, right in your browser.
The core philosophy of Notebook2PDF is absolute privacy and zero server reliance.
When you drag and drop a .ipynb file into the application, the following process occurs entirely on your local machine:
- Local File Reading: The application uses the standard HTML5 File API to read the notebook. The file is never uploaded to an external server or database.
- JSON Parsing: A Jupyter Notebook is essentially a large JSON file. The application parses this JSON to extract the code, markdown, and output cells.
- Component Mapping: The parsed data is fed into React components. Markdown and LaTeX math equations are rendered using
remarkandKaTeX. Python code is styled using a custom Pygments-style syntax highlighter. - Print CSS Engine: When you trigger the PDF download, the application strips away the user interface and applies strict
@media printCSS rules. These rules force standard A4 margins, ensure long array outputs wrap to the next line, and prevent page breaks from splitting code cells in half.
Because everything happens in client-side JavaScript, the tool is stateless, secure, and works on restricted networks.
- 100% Private: Your code and data never leave your device.
- Smart Code Wrapping: Custom CSS ensures long strings and arrays wrap cleanly within the document margins.
- Zero Dependencies: Users do not need to install TeX Live, Pandoc, or any other heavy command-line tools to generate a PDF.
- Math & Markdown Support: Fully supports standard Jupyter markdown, including complex LaTeX formulas.
- Hot-Swapping: Dragging a new updated notebook over an open preview will instantly parse and replace the document.
To generate a PDF using the hosted version or your local build:
- Drop your
.ipynbfile into the upload zone. - Review the parsed document in the preview window.
- Click "Download PDF" to open the browser's print dialog.
- Important: In your browser's print settings, ensure that Margins are set to "Default" or "None" and Background graphics is checked so the syntax highlighting colors appear correctly.
Notebook2PDF is built with React, TypeScript, and Vite. To run the project locally for development or contribution:
- Node.js (v18 or higher recommended)
- npm or standard package manager
- Clone the repository:
git clone https://github.com/vishwajeetbedse/Notebook2PDF.git
- Navigate into the project directory:
cd Notebook2PDF
- Install dependencies:
npm install
- Start the development server:
npm run dev
The application will be available at http://localhost:5173.
This project is licensed under the MIT License. See the LICENSE file for details.