Getting good PDF output from KiCad in Linux

kicad-appicon-128
Update: Turns out SVG might be a better base than PostScript for this. See PDF output from KiCad in Linux from SVG.

I’ve tried to get decent PDF output from KiCad‘s Eeschema a few different ways, but what I’ve found to work most reliably is to first export to PostScript (File > Plot > Plot PostScript) and then use the ps2pdf command from ghostscript to convert to PDF. (The Arch wiki has a good writeup on ps2pdf.)

The biggest problems with this are:

  1. It’s a lot of typing to get the conversion to happen (the minutia of which you won’t have memorized).
  2. It leaves you with both a PostScript and a PDF of the document(s), one of which is likely to get out of sync with the other, which may or may not be in sync with the actual schematic, etc.

To help with this, I use the script below. I drop a copy of it into the root of my KiCad projects and edit the OPTIONS as needed for the project. Then whenever I want PDFs of my schematics, I export PostScript from Eeschema and then click on this script in my file manager. Note that running this script will destroy any *.ps files in the directory—that’s by design.

#!/bin/bash

# DESTRUCTIVELY convert all postscript files
# in working directory to PDF.
# Requires ghostscript.

# Mithat Konar 2013 [http://mithatkonar.com]

OPTIONS="-dOptimize=true -sPAPERSIZE=11x17"

FILES=$(ls -1 *.ps)

for file in $FILES
do
  ps2pdf $OPTIONS $file && rm $file
done

I’ve not tried the script on any PostScript files other than those produced by Eeschema, but I’ve got no reason to think it won’t work on other PS files as well.

2 thoughts on “Getting good PDF output from KiCad in Linux”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.