You’ll want to use an output preset to add these barcodes. At the time the design template is run, it doesn’t yet know how many pages there will be, so that information is not yet available to design scripts. You’ll note that the button for adding page numbers in design simply adds a placeholder which is replaced after the pagination has completed.
First and foremost, you’re going to want to refer to this list of variables:
https://help.objectiflune.com/en/planetpress-connect-user-guide/2020.1/#designer/Output/Print/Variables_available_in_the_Output.htm
This contains a list of all of the variables that you can access in the output preset. You can also pass values forward from your datamapper through metadata if you include a job preset. Your pitcode, for example, would need to be forwarded on in this way and called using ${document.metadata[‘pitcode’]}
For instance, if you wanted a barcode that displayed the current page and total page count, you’d put
${page.sequence.document)${document.count.pages}
If you wanted to do the same for sheet count:
${sheet.sequence.document}${document.count.sheets}
Now these are just the plain count, no padding or anything. so page 1 of 9 would simply be 19. If you want to pad them, simply indicate the total number of characters in 0s after each variable like this
${sheet.sequence.document,0000}${document.count.sheets,0000}
This will zero pad out to 4 total digits, so our page 1 of 9 from above now comes out 00010009.
You can get fancy with these as well, building more conditional logic into them, since the ${} construct is simply a wraper for javascript code in what is otherwise a text field. Similarly to the datamapper, the last value returned in the brackets is your output value. So for instance, some inserters want to know the start, middle, and end of the document. The following would allow you to do that. You’d simply substitute your inserter’s code for the ‘start’, ‘end’, and ‘middle’ values. Maybe that corresponds to 10 for start, 00 for middle, and 01 for end, for instance.
${
var sCollation = '';
var SheetNum = sheet.sequence.document;
var SheetCount = document.count.sheets;
if(SheetNum == 1){
sCollation = 'Start';
} else if(SheetNum == SheetCount){
sCollation = 'End';
} else {
sCollation = 'Middle'
}
}
The window is a bit cramped for typing longer code like this, however, so I’d recommend writing it up in a text editor first, then pasting it in.
One final note, you can, of course, include static text in these without needing to use the ${} wrapper. For instance
${sheet.sequence.document}${document.count.sheets} My barcode is getting long
This will print a barcode with the string 19 My barcode is getting long, including all the spacing and line breaks you include.