2022.2

Table Of Contents
Creatingandusingimagesprites
Step 1. Create a file that contains a collection of images.
Staticimagesmaygoinanytypeofimagefile.Storeimagesthatneedbeaddeddynamicallytothetem-
plate,inonePDFfile,oneimageperpage.
ThereareseveraltoolstocombineimagefilesintoasingePDF.ImageMagickisoneofthem.You
couldusetheconvertcommandoftheImageMagicklibrary:
convert C:/myimages/*.jpg C:/myimages/image-collection.pdf
YoucouldalsouseConnect Designeritself:createaprinttemplatewiththesizeofyourimagesand
setthepagemarginsto0.Createascriptthatloopsoveryourimagesandaddsthemtothetextflowof
thetemplate.SubsequentlygeneratePDFoutputandusetheresultingfileasyourcollectionfile.
Step 2. Add the file that contains the collection of images to the template's Resources (see "Adding images" on
page651).
Step 3. Display part of the collection file as an image in the template.
l
Static imagesthatarepartofanimagefilecanbedisplayedviaCascadingStyleSheets(CSS).
Thistechniqueismuchusedinwebdesign.Inthistechnique,thefilethatcontainsacollectionof
imagesiscalledanimage sprite.ThetrickistocreateaBox(orDiv)foreachimageandgive
thatboxanID(see"Boxes"onpage623).ThenusetheIDinastylesheettoselecttheBoxand
writeastylerule(see"StylingtemplateswithCSSfiles"onpage672)thatsetsitsbackground
imagetotheimagespriteandpositionstheimage.
Foranexplanationandexamplesofthisstylerule,seehttps://www.w3schools.com/css/css_
image_sprites.asp.
l
Dynamically added imagesareloadedinascript.ToretrieveonepagefromaPDFfileina
script,addthepageparametertothefilepathandsetthatasthesourceoftheimage.Hereisan
example(assumingthatthepagenumberisstoredinavariablepageNumber):
var imageStr = "";
var imagePath = "file:///C:/image-collection.pdf?page=" + pageNumber;
imageStr += '<img src="' + imagePath + '">';
results.after(imageStr);
Runtime parameters
Runtime parameterscanpassvaluesfromanautomationtool-PlanetPressWorkflow,usually-toa
template,datamappingconfigurationorJobCreationPreset.Theactualvaluesoftheparametersmay
bedifferentfromonetimethataprocessrunstothenext,whichmeanstheoutputcouldbedifferent
evenwhenthesametemplate,datamappingconfigurationand/orJobCreationPresetsareused.
Page 1352