Blog

How to convert .ipynb to PDF without broken layout

This guide compares the common export paths and shows how to avoid the usual issues: missing fonts, cropped code, and giant outputs.

Updated May 19, 2026

Quick options

  1. Jupyter UI export: Fast, but relies on a LaTeX stack that often breaks fonts.
  2. Local nbconvert: Reliable when your system has TeX and fonts installed.
  3. Cloud conversion: Great when you want zero setup and consistent rendering.

Option 1: Jupyter UI export

In JupyterLab, use File -> Export Notebook As -> PDF. This path is simple, but it uses LaTeX under the hood. If your TeX install or fonts are incomplete, the PDF may show missing glyphs or broken spacing.

Option 2: nbconvert on your machine

If you already have a full LaTeX setup and system fonts, nbconvert works well for research reports and long notebooks.

jupyter nbconvert --to pdf report.ipynb

When output is clipped, try reducing plot sizes or using a wider page template. Large images and long code cells are the main culprits.

Option 3: Cloud conversion (no TeX)

A browser-based renderer avoids the LaTeX dependency. It is a good fit for teams that want consistent output across machines.

curl -X POST https://pypaper.cortode.id.vn/api/convert \
  -H "x-api-key: pp_your_api_key_here" \
  -F "file=@report.ipynb" \
  -F "theme=light" \
  --output report.pdf

Checklist before exporting

  • Limit extremely large output cells or clear them before export.
  • Set figure sizes that fit on A4 or Letter pages.
  • Use Unicode fonts to avoid missing glyphs.
  • Check that code lines wrap and do not overflow the page width.

Recommended settings

For long notebooks, consider hiding code and adding a header or footer so the report is easier to read.

  • hideCode=true for executive summaries.
  • headerText and footerText for titles and page numbers.
  • marginTop and marginBottom around 12-18mm.

API Reference

Use the conversion endpoint

Headers, parameters, responses, and error codes.

Studio

Convert instantly in the browser

Upload a notebook and preview the PDF output.