User:Ssstephen/imposition
I just want to print playing cards as an imposed PDF with crop marks why is this so hard. I liked Simon's page where he wrote his process of trying to do something similar, so here is an attempt at a step by step.
The aim: Take two source PDFs, one is a multi page document with 70 x 95mm playing cards (front only) and another is an arbitrary sized single page PDF with the artwork for the common back of all the cards. I would like to convert these into a single PDF which is 4-up on an A4 sheet, with crop marks (both documents currently have no crop marks or bleed).
Breaking the process into steps:
Make the front pages
Break the document into individual pages
As per Simon's page, pdftk did a good job of this:
#burst the source PDF, keep the name of the source plus page number (-%d) $ pdftk source.pdf burst output source-%d.pdf
Impose 4up on a page using pdfimpose
But first I need to install pdfimpose on breadcube, which at the moment is getting stuck building a wheel for PyMuPDF, when I $ pip install pdfimpose
I get an error ending like this:
running install running build running build_py running build_ext building 'fitz._fitz' extension swigging fitz/fitz.i to fitz/fitz_wrap.c swig -python -o fitz/fitz_wrap.c fitz/fitz.i error: command 'swig' failed: No such file or directory ---------------------------------------- ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-gvmhv_of/pymupdf_2a274ee5eb254f46956890df6daa0bc0/setup.py'"'"'; __file__='"'"'/tmp/pip-install-gvmhv_of/pymupdf_2a274ee5eb254f46956890df6daa0bc0/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-vyct1c_5/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/log/.local/include/python3.9/pymupdf Check the logs for full command output.
So I guess I need to install SWIG first.
When it does work what will I need? Crop marks can be added using mark=[‘crop’]
. pdfimpose seems to work using schemas, there is already one called cards which is 4-up.
Ok pdfimpose installed woo! I tried $ pdfimpose cards cards-1.pdf
and now I have an imposed document. But a) it has toomany-up and b) it needs crop marks.
pdfimpose cards cards-1.pdf --mark crop --back background-resized.pdf
Make the back pages
Resize the document to 70 x 95mm
Image magick can probably do this like below:
#to resize to specific pixel dimensions such as 216x252 $ mogrify -resize 216x252! background-resized.pdf
Tried this and it's not great. Magick seems to convert to raster (boooooo). The real magick is in staying vector. This site seems to have some useful information on that, as well as some related information about visualisation and colour. Anyways I think I will change tactic and try using pdfjam next time (or pypdf or maybe pdftk can do this?). For now it is the right size so I will use it for testing.
Side note can PDF sizes have decimal points? These sizes are 0.1 and 0.2 mm off which aint great.
Run the same imposition as above
When we get that working. Also the pdfimpose cards schema has an option for back
?
Assemble imposed PDFs into a single file
Or not. But could be nice to collate them so the printer can print one doc double sided. Work and turn or tumble? I think the printer in WDKa has the leading edge at the left. Can this be controlled in pdfimpose? From pdfimpose site: "When printing an imposed PDF, it shall be printed two-sided, the binding edge on the left or right."
Here's a short document that explains some imposition basics nicely.