[{"id":"fe9b4ed7647d2453","type":"Barcode Generator","z":"f9687f620c582b41","name":"","data":"partNumber","dataType":"msg","barcode":"qrcode","barcodeType":"barcode","options":"","optionsType":"ui","sendProperty":"payload","props":[{"p":"rotate","v":"N","vt":"str"},{"p":"includetext","v":"true","vt":"bool"},{"p":"alttext","v":"description","vt":"msg"},{"p":"textxalign","v":"left","vt":"str"},{"p":"textxoffset","v":"22","vt":"num"},{"p":"textyoffset","v":"-12","vt":"num"},{"p":"textsize","v":"6","vt":"num"},{"p":"backgroundcolor","v":"ffffff","vt":"str"},{"p":"padding","v":"8","vt":"str"}],"x":1130,"y":900,"wires":[["76c9df14f742d291"]]},{"id":"4482d582a64a9f20","type":"inject","z":"f9687f620c582b41","name":"TRX1252; NUT SET LOCK NUTS 3mm 11 A; 2","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"TRX1252; NUT SET LOCK NUTS 3mm 11 A; 2","payloadType":"str","x":1100,"y":840,"wires":[["e24cdbf275a5523e"]]},{"id":"e24cdbf275a5523e","type":"function","z":"f9687f620c582b41","name":"","func":"//TRX1252; NUT SET LOCK NUTS 3mm 11 A; 2\n\nlet parts = msg.payload.split(\";\");\nmsg.partNumber = parts[0];\nmsg.description = parts[1];\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":980,"y":900,"wires":[["fe9b4ed7647d2453"]]},{"id":"76c9df14f742d291","type":"jimp-image","z":"f9687f620c582b41","name":"","data":"payload","dataType":"msg","ret":"img","parameter1":"FONT_SANS_32_BLACK","parameter1Type":"jimpFont","parameter2":"115","parameter2Type":"num","parameter3":"15","parameter3Type":"num","parameter4":"partNumber","parameter4Type":"msg","parameter5":"HORIZONTAL_ALIGN_LEFT","parameter5Type":"AlignX","parameter6":"VERTICAL_ALIGN_TOP","parameter6Type":"AlignY","parameter7":"","parameter7Type":"auto","parameter8":"","parameter8Type":"auto","sendProperty":"payload","sendPropertyType":"msg","parameterCount":8,"jimpFunction":"print2","selectedJimpFunction":{"name":"print aligned","fn":"print","description":"Print text to the image","parameters":[{"name":"font|str","type":"jimpFont","required":true,"hint":"font to print. NOTE: This can be one of the presets or the path to a fnt file"},{"name":"x","type":"num","required":true,"hint":"x coordinate to print text"},{"name":"y","type":"num","required":true,"hint":"y coordinate to print text"},{"name":"text","group":"options","type":"str","required":true,"hint":"text to print"},{"name":"alignmentX","group":"options","type":"AlignX","required":false,"hint":"X Alignment"},{"name":"alignmentY","group":"options","type":"AlignY","required":false,"hint":"Y Alignment"},{"name":"maxWidth","type":"auto|num","required":false,"hint":"wrap text at maxWidth"},{"name":"maxHeight","type":"auto|num","required":false,"hint":"max height"}]},"x":1290,"y":900,"wires":[["3d7e2f66feea9007"]]},{"id":"3d7e2f66feea9007","type":"image viewer","z":"f9687f620c582b41","name":"","width":"360","data":"payload","dataType":"msg","active":true,"x":1450,"y":900,"wires":[[]]}]
However, why must you create a PDF?
And why must it be saved to file twice - just print it twice!
A better solution would be to print directly from the flow (no files, just the image in memory).
e.g...
Once the barcode is generated (an image in memory), you can use the last field of the CSV data to print the generated image 1, 2, 5 or 50 times (but the barcode only needs to be generated once).
For example...
[{"id":"fe9b4ed7647d2453","type":"Barcode Generator","z":"f9687f620c582b41","name":"","data":"partNumber","dataType":"msg","barcode":"qrcode","barcodeType":"barcode","options":"","optionsType":"ui","sendProperty":"payload","props":[{"p":"rotate","v":"N","vt":"str"},{"p":"includetext","v":"true","vt":"bool"},{"p":"alttext","v":"description","vt":"msg"},{"p":"textxalign","v":"left","vt":"str"},{"p":"textxoffset","v":"22","vt":"num"},{"p":"textyoffset","v":"-12","vt":"num"},{"p":"textsize","v":"6","vt":"num"},{"p":"backgroundcolor","v":"ffffff","vt":"str"},{"p":"padding","v":"8","vt":"str"}],"x":1130,"y":900,"wires":[["76c9df14f742d291"]]},{"id":"4482d582a64a9f20","type":"inject","z":"f9687f620c582b41","name":"start","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":930,"y":820,"wires":[["8c9a3d2abb774c9d"]]},{"id":"76c9df14f742d291","type":"jimp-image","z":"f9687f620c582b41","name":"","data":"payload","dataType":"msg","ret":"buf","parameter1":"FONT_SANS_32_BLACK","parameter1Type":"jimpFont","parameter2":"115","parameter2Type":"num","parameter3":"15","parameter3Type":"num","parameter4":"partNumber","parameter4Type":"msg","parameter5":"HORIZONTAL_ALIGN_LEFT","parameter5Type":"AlignX","parameter6":"VERTICAL_ALIGN_TOP","parameter6Type":"AlignY","parameter7":"","parameter7Type":"auto","parameter8":"","parameter8Type":"auto","sendProperty":"payload","sendPropertyType":"msg","parameterCount":8,"jimpFunction":"print2","selectedJimpFunction":{"name":"print aligned","fn":"print","description":"Print text to the image","parameters":[{"name":"font|str","type":"jimpFont","required":true,"hint":"font to print. NOTE: This can be one of the presets or the path to a fnt file"},{"name":"x","type":"num","required":true,"hint":"x coordinate to print text"},{"name":"y","type":"num","required":true,"hint":"y coordinate to print text"},{"name":"text","group":"options","type":"str","required":true,"hint":"text to print"},{"name":"alignmentX","group":"options","type":"AlignX","required":false,"hint":"X Alignment"},{"name":"alignmentY","group":"options","type":"AlignY","required":false,"hint":"Y Alignment"},{"name":"maxWidth","type":"auto|num","required":false,"hint":"wrap text at maxWidth"},{"name":"maxHeight","type":"auto|num","required":false,"hint":"max height"}]},"x":1290,"y":900,"wires":[["43596d88a839fdd8"]]},{"id":"8c9a3d2abb774c9d","type":"template","z":"f9687f620c582b41","name":"CSV data","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"TRX1188-WHT-LXL; Logo Hat White L / XL; 2\nTRX1252; NUT SET LOCK NUTS 3mm 11 A; 2","output":"str","x":1060,"y":820,"wires":[["4c27d54dde0e8ad8"]]},{"id":"4c27d54dde0e8ad8","type":"csv","z":"f9687f620c582b41","name":"","sep":";","hdrin":"","hdrout":"none","multi":"one","ret":"\\n","temp":"partNumber,description,printCount","skip":"0","strings":true,"include_empty_strings":"","include_null_values":"","x":1190,"y":820,"wires":[["76ff06107b4d6e9d"]]},{"id":"76ff06107b4d6e9d","type":"delay","z":"f9687f620c582b41","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"2","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"x":1340,"y":820,"wires":[["1229bd20fced9377","415111597bd00f93"]]},{"id":"1229bd20fced9377","type":"change","z":"f9687f620c582b41","name":"","rules":[{"t":"set","p":"printCount","pt":"msg","to":"payload.printCount","tot":"msg"},{"t":"set","p":"description","pt":"msg","to":"payload.description","tot":"msg"},{"t":"set","p":"partNumber","pt":"msg","to":"payload.partNumber","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":960,"y":900,"wires":[["fe9b4ed7647d2453"]]},{"id":"43596d88a839fdd8","type":"function","z":"f9687f620c582b41","name":"print x number of times","func":"let printCount = msg.printCount || 1;\n\nfor (let index = 0; index < printCount; index++) {\n msg.printNumber = index+1;\n msg.info = `Printing ${index+1} of ${printCount}`;\n node.send(msg);\n}\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1020,"y":980,"wires":[["7ef48abff1964233"]]},{"id":"7ef48abff1964233","type":"delay","z":"f9687f620c582b41","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"2","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"x":1290,"y":980,"wires":[["3d8facec7b727cab","01ea5e8f9f1a298c"]]},{"id":"3d8facec7b727cab","type":"image viewer","z":"f9687f620c582b41","name":"image to send directly to printer","width":"360","data":"payload","dataType":"msg","active":true,"x":1610,"y":1010,"wires":[[]]},{"id":"01ea5e8f9f1a298c","type":"debug","z":"f9687f620c582b41","name":"","active":false,"tosidebar":false,"console":false,"tostatus":true,"complete":"info","targetType":"msg","statusVal":"info","statusType":"auto","x":1540,"y":952,"wires":[]},{"id":"415111597bd00f93","type":"debug","z":"f9687f620c582b41","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"auto","x":1530,"y":820,"wires":[]}]
Since I do this entirely on the MAC, I prefer a PDF file to be refunded. It could be that there is a problem with the paper format. Therefore it is best to save everything in a PDF file.