Convert D2 to PDF

Turn D2 files into PDF. The main board laid out in the default theme on one page sized to the diagram; layers, scenarios and steps are left out.

Converted in an isolated sandbox on our serversDeleted after 24 hours

Drop D2 files on the dialor turn it to pick what to do

Your D2 diagram as one PDF page.The main board in the default theme, on a page sized to the diagram.

  1. What you get

    A PDF with one page. The page is sized to fit the diagram, so the boxes, arrows and containers sit on a single sheet instead of being split across several.

    The diagram is laid out in the default theme. The output is one file.

  2. What it leaves out

    Only the main board is drawn. Layers, scenarios and steps in your D2 code are left out, so they do not appear in the PDF.

    If your diagram uses them, only what is on the main board is in the file.

  3. When it stops

    If the D2 code cannot be parsed, the conversion stops with input_corrupted. This means the file could not be read as D2 code.

    For other PDF tasks, see every PDF conversion.

D2 and PDF.What each format is.

The formats

From · D2

D2 Diagram

Diagram code in the D2 language: boxes, arrows and containers.

Extensions
.d2
MIME type
text/x-d2
Kind
Text and data
To · PDF

PDF

Fixed-layout pages that look the same everywhere. The exchange format for anything that will be printed or signed.

Extensions
.pdf
MIME type
application/pdf
Kind
Documents

In your code.The same D2 to PDF conversion through the API, for your app or your agent.

terminal
$ cv convert report.d2 report.pdf
$ cv convert report.d2 report.pdf

Questions.What people ask about D2 to PDF.

01OF 04

No. The main board is placed on one page that is sized to the diagram.

No. Layers, scenarios and steps are left out. Only the main board is drawn.

No. The diagram is laid out in the default theme, and this conversion has no options.

The file could not be parsed. The conversion stops when the D2 code cannot be read.

More conversions.Other ways in and out of D2 and PDF.