kicad:good_pdf_output_from_kicad
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
kicad:good_pdf_output_from_kicad [2013/06/18 22:01] – mithat | kicad:good_pdf_output_from_kicad [2013/06/26 02:18] (current) – mithat | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Good PDF output from KiCad in Linux ====== | + | This page is obsolete. See [[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// | + | |
- | + | ||
- | <code bash> | + | |
- | + | ||
- | 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), | + | |
- | + | ||
- | 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 '' | + | |
- | + | ||
- | <file bash makepdf> | + | |
- | # | + | |
- | + | ||
- | # DESTRUCTIVELY convert all postscript files | + | |
- | # in working directory to PDF. | + | |
- | # Requires ghostscript. | + | |
- | + | ||
- | # Mithat Konar 2013 (http:// | + | |
- | + | ||
- | OPTIONS=" | + | |
- | + | ||
- | FILES=$(ls -1 *.ps) | + | |
- | + | ||
- | for file in $FILES | + | |
- | do | + | |
- | ps2pdf $OPTIONS $file && rm $file | + | |
- | done</ | + | |
- | + | ||
- | 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 form SVG files rather than PS. It requires more testing before I'm comfortable " | + | |
- | + | ||
- | <file bash svg2pdf-d> | + | |
- | # | + | |
- | + | ||
- | # DESTRUCTIVELY convert all svg files in working directory to pdf. | + | |
- | # Source file extension is case sensitive! | + | |
- | + | ||
- | # Requires inkscape, gxmessage. | + | |
- | # Mithat Konar 2013 < | + | |
- | + | ||
- | OPTIONS="" | + | |
- | EXT=.svg | + | |
- | SCRIPTNAME=$(basename $0) | + | |
- | + | ||
- | # Make list of files to be processed. | + | |
- | FILES=$(ls -1 *${EXT}) || { gxmessage -title " | + | |
- | + | ||
- | # Get confirmation from user to continue. | + | |
- | gxmessage -title " | + | |
- | -buttons " | + | |
- | -default " | + | |
- | " | + | |
- | + | ||
- | $FILES" | + | |
- | + | ||
- | # Make a temp file to store batch commands. | + | |
- | CMDFILE=$(mktemp) || { gxmessage -title " | + | |
- | + | ||
- | # Build up the list of commands in temp file. | + | |
- | for file in $FILES | + | |
- | do | + | |
- | base=$(basename $file ${EXT}) | + | |
- | echo " | + | |
- | 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 | + | |
- | rm $file | + | |
- | else | + | |
- | not_deleted=" | + | |
- | $file" | + | |
- | rv=1 | + | |
- | fi | + | |
- | done | + | |
- | + | ||
- | if [[ " | + | |
- | gxmessage -title " | + | |
- | "The following files were not deleted: | + | |
- | $not_deleted" | + | |
- | fi | + | |
- | + | ||
- | exit $rv | + | |
- | + | ||
- | # | + | |
- | # Below is an alternative to the approach used above that does not use a | + | |
- | # temp file. It isn't optimal because it restarts inkscape for each file. | + | |
- | # However the simplicity lends itself to porting (e.g., to windows BAT.). | + | |
- | + | ||
- | #~ for file in $FILES | + | |
- | #~ do | + | |
- | #~ base=$(basename $file ${EXT}) | + | |
- | #~ inkscape --without-gui ${OPTIONS} ${file} --export-pdf=${base}.pdf | + | |
- | #~ done | + | |
- | #~ ## END ALT_1 | + | |
- | </ | + |
kicad/good_pdf_output_from_kicad.txt · Last modified: 2013/06/26 02:18 by mithat