User Tools

Site Tools


kicad:good_pdf_output_from_kicad

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
kicad:good_pdf_output_from_kicad [2013/06/23 01:00]
mithat [SVG version]
kicad:good_pdf_output_from_kicad [2013/06/26 03:18] (current)
mithat
Line 1: Line 1:
-====== Good PDF output from KiCad in Linux ====== +This page is obsoleteSee [[PDF Output from KiCad in Linux]] instead.
- +
-There are several ways to generate PDF documents of Eeschema files under Linux. The most reliable way I've found is to first plot to PostScript (//File > Plot > Plot PostScript//​) and then use the ''​ps2pdf''​((The [[https://​wiki.archlinux.org/​index.php/​Ps2pdf|Arch wiki]] has a good writeup on ''​ps2pdf''​.)) command from ''​[[http://​www.ghostscript.com/​|ghostscript]]''​ to convert to PDF+
- +
-<code bash>​ps2pdf -dOptimize=true -sPAPERSIZE=11x17 *.ps</​code>​ +
- +
-The biggest problems with this are: +
- +
-  - It’s a lot of typing to get the conversion to happen (the minutia of which you won’t have memorized). +
-  - 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 a KiCad project and edit the ''​OPTIONS''​ as needed for the project. Then whenever I want PDFs of my schematics, I plot 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. +
- +
-<file bash makepdf>​ +
-#​!/​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</​file>​ +
- +
-I’ve not tried the script on PostScript files other than those produced by Eeschema, but I’ve got no reason to think it won’t work on other PostScript files as well. +
- +
-===== SVG version ===== +
-I am currently testing the following for working from SVG files rather than PS. It also uses a GUI dialog based interface. It needs more testing before I'm comfortable "​releasing"​ it. +
- +
-<file bash svg2pdf-d>​ +
-#​!/​bin/​bash +
- +
-########################################################################​ +
-# This program is free software: you can redistribute it and/or modify +
-# it under the terms of the GNU General Public License as published by +
-# the Free Software Foundation, either version 3 of the License, or +
-# (at your option) any later version. +
-+
-# This program is distributed in the hope that it will be useful, +
-# but WITHOUT ANY WARRANTY; without even the implied warranty of +
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ​ See the +
-# GNU General Public License for more details. +
-+
-# You should have received a copy of the GNU General Public License +
-# along with this program. ​ If not, see <​http://​www.gnu.org/​licenses/>​. +
-########################################################################​ +
- +
-# Copyright (C) 2013 Mithat Konar <​http://​mithatkonar.com>​ +
- +
-# DESTRUCTIVELY convert all svg files in working directory to pdf. +
-# Source file extension is case sensitive! +
- +
-# Requires inkscape, gxmessage. +
- +
-OPTIONS=""​ +
-EXT=.svg +
-SCRIPTNAME=$(basename $0) +
- +
-# Make list of files to be processed. +
-FILES=$(ls -1 *${EXT}) || { gxmessage -title "​$SCRIPTNAME"​ "No ${EXT} files to convert.";​ exit 1; } +
- +
-# Get confirmation from user to continue. +
-gxmessage -title "​$SCRIPTNAME"​ \ +
-  -buttons "​GTK_STOCK_NO:​1,​GTK_STOCK_YES:​0"​ \ +
-  -default "​GTK_STOCK_YES"​ \ +
-"​Desctructively convert the following to PDF? +
- +
-$FILES"​ || exit 1 +
- +
-# Make a temp file to store batch commands. +
-CMDFILE=$(mktemp) || { gxmessage -title "​$SCRIPTNAME"​ "​Error:​ Could not create temp file." 1>&​2;​ exit 1; } +
- +
-# Build up the list of commands in temp file. +
-for file in $FILES +
-do +
-    base=$(basename $file ${EXT}) +
-    echo "​${file} --export-pdf=${base}.pdf"​ >> $CMDFILE +
-done +
- +
-# Process commands in a batch. +
-DISPLAY= inkscape ${OPTIONS} --shell < $CMDFILE +
-rm -f $CMDFILE +
-echo +
- +
-# Delete old files. +
-# Since inkscape exits with 0 even with errors, we need to explicitly check +
-# for conversion before deleting originals. +
-rv=0 +
-not_deleted=""​ +
-for file in $FILES +
-do +
-    base=$(basename $file ${EXT}) +
-    if [[ -f ${base}.pdf ​]]; then +
-        rm $file +
-    else +
-        not_deleted="​$not_deleted +
-$file"​ +
-        rv=1 +
-    fi +
-done +
- +
-if [[ "​x$not_deleted"​ != "​x"​ ]] ; then +
-    gxmessage -title "​$SCRIPTNAME"​ \ +
-      "The following files were not deleted: +
-$not_deleted"​ +
-fi +
-exit $rv +
-</​file>​ +
kicad/good_pdf_output_from_kicad.txt · Last modified: 2013/06/26 03:18 by mithat