Frequently Asked Question:
Convert a multipage TIFF image to a multipage PDF
Can your product convert multi-page TIFF fax image files to multi-page PDF documents?
Yes, absolutely. The AddImageFromFile and GetImagePageCount functions will assist you here. The first thing you need to do is use the GetImagePageCount function to find out the number of pages in the TIFF image. Then you can use that information along with the AddImageFromFile function to convert your multipage TIFF image to a multipage PDF document.
Here's some sample code written in JScript that shows you how:
// Count pages in TIFF image
TiffPages = QP.GetImagePageCount("multipage.tif");
// Loop through each page in the TIFF image
// and add it to a blank page in the
// new PDF document.
for (n = 1; n < TiffPages; n++)
{
// Load a sample image into memory. We'll
// loop through each page in the TIFF image.
QP.AddImageFromFile("multipage.tif", n);
// Get the width and height of the image
lWidth = QP.ImageWidth();
lHeight = QP.ImageHeight();
// Reformat the size of the page in the selected document
QP.SetPageDimensions(lWidth, lHeight);
// Draw the image onto the page using the specified width/height
QP.DrawImage(0, lHeight, lWidth, lHeight);
}
// Save the new multipage PDF to disk
QP.SaveToFile("multipage.pdf");