PDF Card Extraction

08/06/20

Categories: Projects Tags: Nandeck

~/contents

I sometimes encounter situations where a PNP file is formatted in a way that runs counter to my preferred workflow, and my choice is either to change the way I build or create a new file to print.

I have in the past used GIMP’s Image Transform Guillotine Into Layers, followed by Export Layers, to extract cards and this works OK but I still have to handle every single page individually, and it can be a bit of a nuisance overall because of the way the plugins handle layer names and export names.

ExtractPDF does a good job of extracting embedded images from PDFs, but the card sheet may not be built in a way that allows you to extract individual cards. The best tool I have found for easily slicing cards is GIMP with plugins. This method assumes you have a multi-page PDF and all the pages are laid out the same.

Import the .pdf as a layered image in GIMP.

Crop the image down to the card edges. Sometimes Image > Crop to Content will do this, sometimes you have to manually remove extra whitespace. I usually crop 1 pixel on the inside of the card border.

Grab the rulers on the left and top and drag right or down, respectively, to create guidelines.

Image > Transform > Guillotine. (I used to use Guillotine into Layers, but came to realize it is actually much faster to do it this way because of the way Gimp assigns names to new images and layers.) Guillotine will slice the layered image into layered slices, so in this example I ended up with 7 new layered images, 4 of which are 14 cards each.

Use Export layers as PNG to export these. Now you can set up a template however you want, and for me it’s easy to build a a 9-card sheet in Nandeck. This particular file already had bleeds built-in, so I did not need to create bleeds.

'Size definitions
UNIT=MM
PAGE=210,297,PORTRAIT,HV
CARDSIZE=63,88

'Create cutting guides and bleeds BORDER=RECTANGLE,#000000,0.1,MARKDOT,#0000FF EDGE=1,NULL

'Double sided [cardback]=55 DUPLEX=[all],[cardback] PRINT=DUPLEX

'Create a list of images files from a folder [images]=DIRFILES("allcards",*.png) [all]=1-{(images)}

'Put an image on each card IMAGE=[all],[images],0,0,100%,100%,0,A IMAGE=[cardback],"allcards-back.png",0,0,100%,100%,0,A