image_to_pdf
Convert one or more images into a single PDF file.
Parameters
- sourcesarrayone of
sourcesorsource_key - Array of source images. Each item can be a file path string or object:
{ path = "..." }or{ base64 = "..." }. - source_keystringone of
sourcesorsource_key - Context key containing an array of source images (same formats as
sources). - output_pathstringrequired
- Destination path for generated PDF. Supports
${ctx.key}interpolation. - output_keystringdefault pdf_path
- Context key to store generated PDF path.
Paths inside image entries support ${ctx.key} interpolation.
Image entry formats
String
"images/logo.png"
Object
{ path = "images/logo.png" }
{ base64 = "iVBORw0KGgoAAAANSUhEUg..." }
Context Output
<output_key>(defaultpdf_path) — output PDF path.image_count— number of source images processed.<output_key>_count— same asimage_count.<output_key>_success— booleantrue.
Example
local flow = Flow.new("images_to_pdf")
flow:step("make_pdf", nodes.image_to_pdf({
sources = {
"data/images/front.png",
"data/images/back.png",
},
output_path = "output/gallery.pdf",
output_key = "pdf_file"
}))
flow:step("log", nodes.log({
message = "Wrote ${ctx.pdf_file} with ${ctx.pdf_file_count} page(s)"
})):depends_on("make_pdf")
return flow