Tip of the day: Joining images to one PDF file
Function CreatePrintPDF(jpgFiles() as folderitem, pdfFile as FolderItem, PageWidth as integer, PageHeight as integer) As Boolean
// have files?
If pdfFile = Nil Then Return False
If jpgFiles = Nil Then Return False
If jpgFiles.Ubound < 0 Then Return False
// new DynaPDF
Dim pdf As New MyDynapdfMBS
// page width/height in MilliMeter
Dim pdfWidth As Integer = PageWidth * 72 / 25.4
Dim pdfHeight As Integer = PageHeight * 72 / 25.4
// put your license here
Call pdf.SetLicenseKey "Starter"
// create pdf
Call pdf.CreateNewPDF pdfFile
// set a couple of options
Call pdf.SetPageCoords(MyDynaPDFMBS.kpcTopDown)
Call pdf.SetResolution(300)
Call pdf.SetUseTransparency(False)
Call pdf.SetSaveNewImageFormat(False)
Call pdf.SetGStateFlags(MyDynaPDFMBS.kgfUseImageColorSpace, False)
Call pdf.SetJPEGQuality(100)
// set page size
Call pdf.SetBBox(MyDynaPDFMBS.kpbMediaBox, 0, 0, pdfWidth, pdfHeight)
Call pdf.SetPageWidth(pdfWidth)
Call pdf.SetPageHeight(pdfHeight)
// append pages with one image per page
For i As Integer = 0 To jpgFiles.Ubound
Call pdf.Append
Call pdf.InsertImageEx(0, 0, pdfWidth, pdfHeight, jpgFiles(i), 1)
Call pdf.EndPage
Next
// close
Call pdf.CloseFile
Return True
End Function