We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Multi page tiff to PDF with different size tiff pages

Hi,

I’ve got some multi page tiff files that need to be converted to PDF. However the tiff file contains pages of different sizes, eg A4., A3, A1, etc.

I tried to convert using your sample code, but all the pages come out in A4.

// Instantiate an object PDF class
Aspose.Pdf.Generator.Pdf pdf = new Aspose.Pdf.Generator.Pdf();
// add the section to PDF document sections collection
Aspose.Pdf.Generator.Section section = pdf.Sections.Add();
// create an image object
Aspose.Pdf.Generator.Image image = new Aspose.Pdf.Generator.Image(section);
// provide the path for TIFF image file</div>
image.ImageInfo.File = @“c:/temp/A1_A4_A4i.tif”; // (multipage tiff - included)
// specify the input image file type
image.ImageInfo.ImageFileType = Aspose.Pdf.Generator.ImageFileType.Tiff;
// add image to paragraphs collection of section
section.Paragraphs.Add(image);
// specify the value to include all the frames of image file into resultant PDF
image.ImageInfo.TiffFrame = -1;
image.ImageInfo.IsBlackWhite = true;
//Save the pdf document
pdf.Save(@“c:\temp\A1_A4_A4.pdf”);

Should the above convert the pages using the input page size or is additional coding required?

I have attached a sample file that contains A1 and 2 A4 pages.

Regards,
Bernard

Hi Bernanr,


Thanks for contacting support.

A4 is the default page size when creating PDF documents using Aspose.Pdf for .NET. However you can also set the page dimensions for resultant PDF. But as your source TIFF contains frames with various sizes, so you may consider first converting the multi-page TIFF to single page TIFF images using Aspose.Imaging for .NET and then convert individual TIFF image to PDF format using Aspose.Pdf for .NET and finally concatenate separate PDF files to generate a single merged PDF document. For further details, please visit


In the event of any further query, please feel free to contact.

Thanks Nayer,
What I did in the end, using Aspose.Pdf for .NET, was to convert each page to a single PDF and then concatenate the pages.

By doing it this way I will not need the Aspose.Imaging for .NET product.

Thanks for your help.

Regards,
Bernard

Hi Bernard,


Thanks for sharing the feedback.

We are glad to hear that your problem is resolved. Please continue using our API and in the event of any further query, please feel free to contact.