<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Dipsac</title>
    <description>The latest articles on DEV Community by Dipsac (@dipsac_023f82a54663ed84f0).</description>
    <link>https://dev.to/dipsac_023f82a54663ed84f0</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4225770%2Ffa246fe4-4bf3-4d17-a731-9f1252af37aa.png</url>
      <title>DEV Community: Dipsac</title>
      <link>https://dev.to/dipsac_023f82a54663ed84f0</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/dipsac_023f82a54663ed84f0"/>
    <language>en</language>
    <item>
      <title>Converting draw.io files to PDF — the CLI way and the lazy way</title>
      <dc:creator>Dipsac</dc:creator>
      <pubDate>Wed, 04 Nov 2026 08:58:19 +0000</pubDate>
      <link>https://dev.to/dipsac_023f82a54663ed84f0/converting-drawio-files-to-pdf-the-cli-way-and-the-lazy-way-mdk</link>
      <guid>https://dev.to/dipsac_023f82a54663ed84f0/converting-drawio-files-to-pdf-the-cli-way-and-the-lazy-way-mdk</guid>
      <description>&lt;p&gt;Every team I've worked with keeps architecture diagrams in draw.io, and every team eventually hits the same question: how do we get clean PDFs out of these files — ideally in CI?&lt;/p&gt;

&lt;p&gt;Here's what actually works in 2026.&lt;/p&gt;

&lt;h2&gt;
  
  
  The CLI way (for pipelines)
&lt;/h2&gt;

&lt;p&gt;draw.io Desktop ships a headless export mode. On a machine with a display server:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;drawio -x -f pdf -o output.pdf input.drawio
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;In CI you need a virtual display, so wrap it with xvfb:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;xvfb-run drawio -x -f pdf -o output.pdf input.drawio
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Or skip the setup entirely and use the community Docker image:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker run -v $(pwd):/data rlespinasse/drawio-export
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;This renders every page of the file to PDF. It's the right answer for automated builds — reproducible, versionable, no manual steps.&lt;/p&gt;

&lt;p&gt;Two gotchas I hit:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Some CLI builds choke on &lt;strong&gt;compressed&lt;/strong&gt; .drawio files (the default save format embeds deflated XML). If exports come out empty, uncompress the file first (File → Properties → uncheck "Compressed" in the editor).&lt;/li&gt;
&lt;li&gt;Page sizing: without --crop you get the configured page size, not the diagram bounds, so wide diagrams get cut or padded.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The lazy way (for everything else)
&lt;/h2&gt;

&lt;p&gt;For one-off conversions — checking output before committing, exporting a file someone emailed you, batch-converting a folder of diagrams — spinning up Docker is overkill.&lt;/p&gt;

&lt;p&gt;I built a free browser tool for exactly this: it does server-side conversion to vector PDF, handles compressed .drawio files that CLI builds reject, renders each page at its own size (no blank interleaves), and takes up to 10 files in a batch:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dipsac.com/tools/pdf-tools/convert-drawio-to-pdf-online" rel="noopener noreferrer"&gt;https://dipsac.com/tools/pdf-tools/convert-drawio-to-pdf-online&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Disclosure: it's my tool. Free, no signup, files are deleted after processing. There's also a Russian/Spanish/Portuguese version if your team isn't English-first.&lt;/p&gt;

&lt;h2&gt;
  
  
  Which one when
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;CI/CD, repeatable builds&lt;/strong&gt; → drawio CLI or the Docker image&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;One-offs, compressed files, quick checks, non-dev teammates&lt;/strong&gt; → browser tool&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Need SVG/PNG instead&lt;/strong&gt; → the CLI does both with -f svg / -f png&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you've found a cleaner way to handle compressed files in the CLI, tell me in the comments — that's the one wart I never fixed properly.&lt;/p&gt;

</description>
      <category>devops</category>
      <category>webdev</category>
      <category>productivity</category>
      <category>showdev</category>
    </item>
  </channel>
</rss>
