ipynbtopdfscanner

Jupyter PDF Cuts Off Code or Tables? How to Fix It

Why long code lines and wide pandas tables get cut off when you save a Jupyter notebook as PDF, and four ways to fix it.

Updated · by the ipynbtopdfscanner team

Quick answer: Code gets cut off because LaTeX and browser printing don’t wrap long lines, and wide tables don’t shrink to the page. Fix it by converting with a tool that wraps code and fits tables to the page (ipynbtopdfscanner does both automatically), or by shortening lines, limiting DataFrame columns and using landscape pages.

Why it happens

Fix 1: Use a converter that wraps and fits content

ipynbtopdfscanner wraps long code lines, shrinks wide tables to the page width (repeating the header row on each page) and moves anything that won’t fit to the next page instead of slicing it.

Fix 2: Shorten long lines

Keep code under about 90 characters per line. A formatter like Black does this for you:

pip install black "black[jupyter]"
black notebook.ipynb

Fix 3: Limit what pandas prints

import pandas as pd
pd.set_option("display.max_columns", 10)   # show at most 10 columns
pd.set_option("display.max_rows", 30)      # and 30 rows
df.head()

Fix 4: Use landscape pages

Landscape gives about 40% more width for wide tables. In ipynbtopdfscanner, choose Orientation → Landscape; in the print dialog, choose Layout → Landscape.

Skip the setup: convert your notebook to PDF in your browser, free and private.

Open the converter

Frequently asked questions

How do I stop images being split across PDF pages?

Use a converter with smart page breaks, such as ipynbtopdfscanner, which moves a chart that doesn’t fit to the next page and scales very tall images to fit one page.

Can I make the PDF text smaller so more fits?

Yes. In ipynbtopdfscanner use the Size slider (75–130%) or choose Narrow margins.