I'm trying to use this node to create a PDF from a 'document description' as a project for my IoT students to automatically create a newsletter using text and images from external sources. So far text insertion works fine, the problem is inserting an image as per the supplied example with the node.
With help from @zenofmud I have this flow which uses http-request to insert an external image (from a remote server or a server like NGINX on a local RPi) successfully in to a document.
[{"id":"00613c000e438d73","type":"file","z":"d089cbcf16e105d6","name":"","filename":"zzz.pdf","appendNewline":true,"createDir":false,"overwriteFile":"true","encoding":"none","x":1130,"y":1660,"wires":[[]]},{"id":"8a372253633bb4fc","type":"pdfmake","z":"d089cbcf16e105d6","name":"","outputType":"Buffer","inputProperty":"payload","options":"{}","outputProperty":"payload","x":980,"y":1660,"wires":[["00613c000e438d73"]]},{"id":"ece6ac22c59f46f6","type":"function","z":"d089cbcf16e105d6","name":"","func":"let picture = msg.payload;\n\nlet dd= {\n \"pageSize\": \"A5\",\n \"pageOrientation\": \"portrait\",\n \"pageMargins\": [\n 40,\n 60,\n 40,\n 60\n ],\n \"info\": {\n \"title\": \"My awesome document\",\n \"author\": \"David Dempster\",\n \"subject\": \"Just testing PDFmaker\",\n \"keywords\": \"Node-RED, Raspberry Pi, RPi\"\n },\n \"content\": [\n \"Sample Image from file\",\n {\n \"image\": \"data:image/jpeg;base64,\" + picture,\n \"width\": 200\n },\n \"Sample SVG\",\n {\n \"svg\": \"<svg width=\\\"300\\\" height=\\\"200\\\" viewBox=\\\"0 0 300 200\\\"><polygon points=\\\"100,10 40,198 190,78 10,78 160,198\\\" style=\\\"fill:lime;stroke:purple;stroke-width:5;fill-rule:evenodd;stroke-linecap:round;\\\"/></svg>\",\n \"width\": 150\n }\n\n ]\n}\n\nmsg.payload = dd;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":820,"y":1660,"wires":[["8a372253633bb4fc"]]},{"id":"2be58c956b005552","type":"http request","z":"d089cbcf16e105d6","name":"","method":"GET","ret":"bin","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"","senderr":false,"x":470,"y":1660,"wires":[["05c80df79fda374f","98851d9bd00d1d05","1c90cdd62290c3fe"]]},{"id":"bb8a456f3b3e783d","type":"inject","z":"d089cbcf16e105d6","name":"castleton_ducks.jpg remote access","props":[{"p":"url","v":"http://resources-area.co.uk/pics_of_places/castleton_ducks.jpg","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":200,"y":1600,"wires":[["2be58c956b005552"]]},{"id":"05c80df79fda374f","type":"image","z":"d089cbcf16e105d6","name":"Latest detections","width":"320","data":"payload","dataType":"msg","thumbnail":false,"active":true,"pass":false,"outputs":0,"x":490,"y":1780,"wires":[]},{"id":"98851d9bd00d1d05","type":"debug","z":"d089cbcf16e105d6","name":"debug 12","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":460,"y":1720,"wires":[]},{"id":"1c90cdd62290c3fe","type":"base64","z":"d089cbcf16e105d6","name":"","action":"str","property":"payload","x":660,"y":1660,"wires":[["aadffb260219948d","ece6ac22c59f46f6"]]},{"id":"aadffb260219948d","type":"debug","z":"d089cbcf16e105d6","name":"debug 15","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":660,"y":1720,"wires":[]},{"id":"a5887fe74433f4ba","type":"inject","z":"d089cbcf16e105d6","name":"san_francisco on remote server","props":[{"p":"url","v":"http://resources-area.co.uk/pics_of_places/san_francisco.jpg","vt":"str"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":190,"y":1660,"wires":[["2be58c956b005552"]]},{"id":"3b2a62bf1f2b029e","type":"inject","z":"d089cbcf16e105d6","name":"mini_tower on my server","props":[{"p":"url","v":"http://192.168.1.152/pics_of_places/mini_tower.jpg","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":170,"y":1720,"wires":[["2be58c956b005552"]]},{"id":"bc103ac244be3b1c","type":"comment","z":"d089cbcf16e105d6","name":"This works with the http request node and base64","info":"","x":590,"y":1600,"wires":[]}]
I was hoping I could reference the images from within the 'document description (dd)' rather than having to perform an http request, as my students would like to embed more than one image.
My objective was for the students to be able create a newsletter automatically for our weather stations and send it out to a distribution list or make it available via a Telegram request.
e.g. Collect temp/humidity readings and insert this as text, together with a set of related images.
Would appreciate hearing from anyone who has managed to insert multiple images with the example supplied with the 'pdfmake' node, or have found another method of achieving this task..