IPYNB Hub 中文 Convert free

IPYNB Hub guide

How to Convert IPYNB to PDF: 4 Ways, No LaTeX Needed

Every route from notebook to PDF, what each one costs you, and the fixes for the four things that usually break.

Convert a notebook to PDF — free

Short answer: download the notebook as a file (in Colab: File → Download → Download .ipynb), drop it on the browser converter, tick Hide code if you only need the results, and choose Save as PDF in the print dialog. It needs no Python, no LaTeX and no account, and the file never leaves your device.

The four routes, compared

Route What it needs Code outputs Where it breaks
Browser converter Nothing Kept as saved Very large image-heavy notebooks are slower
Colab print A Google account Kept as saved Long lines clipped, wide tables cut
Jupyter / JupyterLab print Python + Jupyter Kept as saved Same margin problems, no scaling
nbconvert Pandoc + TeX Live Kept as saved LaTeX setup, CJK fonts, template tweaks

1. In the browser, no install

This is the route most people want when the PDF is for someone else rather than for themselves.

  1. Get the notebook as a file. In Colab use File → Download → Download .ipynb; in JupyterLab or VS Code, right-click the notebook and choose Download.
  2. Drop it on the converter. Tick Hide code for a results-only hand-in, or Hide outputs when you are reviewing code. The sample notebook lets you check the layout before you commit your own file.
  3. Click Save as PDF, pick Save as PDF as the destination, and switch off headers and footers so the page does not carry the URL and the print date.

Because the notebook is rendered as HTML and printed by the browser's own engine, long code wraps instead of disappearing, wide DataFrames are scaled to the page width, and the text in the PDF stays selectable. Nothing is uploaded — you can watch the Network tab stay quiet while you convert.

2. Printing from Google Colab

Colab renders the notebook in the browser, so File → Print (or Ctrl/Cmd + P) gives you a usable PDF when the notebook is simple: short code lines, no wide tables, no large charts.

What it cannot do is reflow. The printed page keeps the browser's layout, so a cell that scrolls sideways on screen is simply cut at the margin, a 30-column DataFrame loses its right half, and a figure taller than the page breaks in two. Turn off headers and footers, and pick landscape if a table is the only problem.

3. Printing from Jupyter or JupyterLab

The local Jupyter UI has the same print path and the same limits. It is fine for a text-heavy notebook, and it keeps the outputs you already ran, but it has no options for margins, scaling or code visibility beyond what the CSS gives you.

4. nbconvert on the command line

If you already live in a Python environment, nbconvert is the most configurable option:

jupyter nbconvert --to pdf report.ipynb
jupyter nbconvert --to pdf --no-input report.ipynb

The first command fails on a clean machine more often than not, because --to pdf chains through LaTeX: you need Pandoc, a TeX distribution and, for non-Latin text, the right CJK fonts. xelatex not found means the TeX distribution is missing or not on PATH. --to webpdf avoids LaTeX by rendering in Chromium, but it pulls in Playwright and a browser download.

What usually goes wrong, and the fix

Symptom Cause Fix
Long code lines vanish at the right margin Print CSS does not wrap pre blocks Use a converter that sets white-space: pre-wrap
A wide DataFrame is cut in half No page-width scaling Print landscape, or scale tables to fit
A chart splits across two pages Page break lands inside a figure Keep figures together and break before it
Charts print blank Outputs were never saved, or a JavaScript widget drew them Run all cells and save; export the chart as a static image
Chinese, Japanese or Korean text prints as boxes LaTeX has no CJK font Print through the browser (system fonts) or install fonts for XeLaTeX
The PDF has the URL and date on every page Browser headers and footers are on Switch them off in the print dialog

Which route should you pick?

  • You need one PDF to hand in or send → browser converter. Fastest, nothing to install, keeps the outputs you already have.
  • You are already using LaTeX and need exact typography → nbconvert, with --no-input if code should be hidden.
  • You only want a quick look at a Colab notebook → print from Colab, but expect clipping on anything wide.
  • You only want to read the notebook, not print it → the IPYNB viewer opens it in the tab; the IPYNB to HTML converter gives you a shareable page instead of paper.

Conversion problems, answered

The questions that come up most often when a notebook refuses to print properly.

Does converting a notebook to PDF execute my code?

No. Every route here renders the outputs that are already saved inside the .ipynb file. If a cell was never run, its output will be empty in the PDF — run all cells and save the notebook first.

Do I need Python or LaTeX installed?

Not for the browser route. The converter on the home page reads the notebook and lays it out in your tab, so there is no Python, Pandoc or TeX Live to install. nbconvert, on the other hand, needs Pandoc and a working LaTeX distribution.

Why does nbconvert fail with xelatex not found?

Because the PDF writer it calls is missing. Install a TeX distribution — texlive-xetex on Debian or Ubuntu, MiKTeX on Windows, MacTeX on macOS — restart the shell so the binary lands on PATH, then rerun the command. The --to webpdf option avoids LaTeX but needs Playwright and a Chromium build.

Why are my long code lines cut off in the PDF?

Print stylesheets leave pre blocks at their natural width, and anything past the right margin is silently dropped. A converter that sets white-space: pre-wrap fixes it; with nbconvert you have to adjust the LaTeX template or shrink the font until the longest line fits.

Can I convert a notebook straight out of Google Colab?

Download it first: File → Download → Download .ipynb. Printing directly from the Colab tab works, but the browser view is laid out for scrolling rather than A4, so wide tables and charts usually break across pages.

Is the text in the finished PDF selectable?

Yes, when the PDF is produced from HTML text rather than a screenshot — paragraphs, code and table cells stay selectable and searchable, which matters for graders and screen readers.

Turn your notebook into a PDF

Drop an .ipynb file into the converter and save it as a PDF. Nothing is uploaded.

Open the IPYNB to PDF converter