Best practice for converting multiple TIFF/JPG files to a single XOD


What is the best practice for combining multiple TIFF/JPG files into a single XOD for viewing?


There are a couple of options, any of which could be the “best practice” for your scenario.

Probably the easiest method would be to convert each image to a PDF with Convert.ToPDF():

You could then combine the PDFs together, as demonstrated in the PDFPage sample:

and then you could convert the result to Xod with Convert.ToXod().

Alternately, you could compose a single PDFDoc containing the images by placing them onto PDF pages, as shown by the AddImage sample:

Then you could convert the PDFDoc to Xod with Convert.ToXod().

If you have some image processing software, you could merge the images into a single multi-page TIFF, then convert directly to Xod.

You can simply call ‘pdftron.PDF.Convert.ToPdf(doc, “my.tif”)’ before saving doc to XOD. Despite the name, the function is not going to save/serialize PDF… it will just keep image data around until the file is explicitly saved as PDF, XPS, or XOD.

This technique will scale well even for huge (multi GB) image collections.

If you need more control/flexibility with regards to how images are planed on a page (e.g. rotation, layout) use ElementBuilder/Writer as shown in AddImage sample project.