This repo keeps my pdf processing howto in Linux (and possibly all other OS-es)
Most of used tools are easy to install and can make your pdf processing so easy and enable you to save a lot of time. Of source you can use Inkscape to hand craft your pdf (and sometimes it is best option), but there are a lot of tools in the wild, which can save you enormous amount of time.
I love to craft my own PNP (Play And Print) board/card/rpg games. There are plenty of PNP games in boardgamegeek.com and other sites, but usually those downloadable files are unfortunately not very good for direct printing. I like to keep my games small in size, print only necessary components, modify graphics, adding cutting (crop) marks, etc. So PDF processing is necessary. This readme should give you ideas, how to attack some tasks and will remind me how to do it, when I forget.
I use all of following tools. Order is not important, they are all great and essential for me.
Command line:
- pdftk
- pdfjam
- poppler (poppler utils)
- imagemagick (and scripts)
- gs
- pdfcpu (https://github.com/pdfcpu/pdfcpu)
GUI:
- pdfbooklet (Windows version)
- pdfarranger (flathub)
- pdf mix tools (flathub)
- scantailor
PocketMod is a paper folded in a way it forms a small book.
Prepare
git clone https://github.com/DavidFirth/pdfjam-extras
sudo cp pdfjam-extras/bin/* /usr/local/bin/Converting fonts to paths allows you to edit PDF in something like Inkscape without worrying about missing fonts.
gs -o out-txtpath.pdf -dNoOutputFonts -sDEVICE=pdfwrite in.pdfAdding elements like cutting marks or other helpers into existing pages.
Example with background:
pdftk org.pdf background my/my_cutting_marks.pdf output my/out.pdfAdding it on top of current page (may be necessary if page is not white)
pdftk org.pdf stamp my/my_cutting_marks.pdf output my/out.pdfAdding elements on top of current page like above, but only on selected pages.
#!/bin/sh
# this will stamp all pages ignoring given ammount of pages from the end of pdf
# run as: script in.pdf 2 my_cutting_marks.pdf out.pdf
# inspired by: https://stackoverflow.com/questions/20573217/how-to-stamp-only-the-last-page-of-a-pdf
cutto=`expr $2 + 1`
# separate files
pdftk $1 cat 1-r$cutto output tmp-1.pdf
pdftk $1 cat r$2-end output tmp-2.pdf
# stamp
pdftk tmp-1.pdf stamp $3 output tmp-1s.pdf
# re-attach
pdftk tmp-1s.pdf tmp-2.pdf cat output $4Move content on all pages 5mm down. TODO: Does it work as expected?
pdfjam --suffix pushed-down --offset '0mm -5mm' input.pdffor f in `ls cards-*`; do
echo Processing $f
multicrop2 -d 1000 -c 40,40 $f cards/$(basename $f .jpg).tiff
doneMerge pdf's to one. Using gs is very effective, but may cause graphic glitches. Be carreful, use print preview, as black border glitch is only visible on print preview.
gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress -sOutputFile=OneDeckDungeon_Rules-print-gs.pdf ODDR-0*.pdfAlternative, much bigger output:
pdfunite files*.pdf final.pdfSplit file (cat)
pdftk in.pdf cat 10-12 output 10-12p.pdf