Free Support Forum - aspose.com

Create TIF file with first x pages from PDF

Hi,

how can I create a multipage TIF file from a PDF file processing the first x pages only?
Example: The PDF file contains 100 pages but I only need the first 5 pages in the TIF file.


Thanks
Carsten

Hi Carsten,

You can use SaveAsTIFF method to convert a PDF file to a multi-page TIFF file. You can also set StartPage and EndPage properties to specify the page range to be converted; you need to set these properties before DoConvert method:


//create PdfConverter object


PdfConverter objConverter = new PdfConverter();


//bind input pdf file


objConverter.BindPdf(“input.pdf”);


objConverter.StartPage = 1;

objConverter.EndPage = 10;


//initialize the converting process


objConverter.DoConvert();


//save pdf as tiff image


objConverter.SaveAsTIFF(“output.tif”);


//close the PdfConverter object


objConverter.Close();


I hope this helps. If you have any further questions, please do let us know.
Regards,

Hi Shahzad,

that is what it did, but the resulting tiff file always has the same number of pages as the source pdf file.
I am using rel. 5.1.0.0 of Aspose.Pdf.Kit.

Any other suggestions?

Thanks
Carsten

Hi Carsten,

I have reproduced this problem at my end and logged it as PDFKITNET-23635 in our issue tracking system. Our team will look into this issue and you’ll be updated via this forum thread once it is resolved.

We’re sorry for the inconvenience.
Regards,

Hi Shahzad,

thank you for the update.
Do you have any information about the timeframe for the bugfix?
That is the last issue on my evaluation list and I don't want to miss the "Aspose.Total 25% discount" ;-)

Thanks
Carsten

Hi Carsten,

I have asked our development team to share the ETA of this issue. You’ll be notified as soon as the response is received.

We’re sorry for the inconvenience.
Regards,

The issues you have found earlier (filed as 23635) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.

Hi Team,

I’m using Aspose.Pdf.Kit 5.5.0 in my application.

Still I’m unable to create a tiff with text/image from a pdf having multiple pages. ie the tiff is having only first page from the pdf. I want to have multiple pages of the pdf into an image stream or tiff image.

Please find the code

MemoryStream mStream=new MemoryStream();

Aspose.Pdf.Kit.PdfConverter pdfConvertor = new PdfConverter();
pdfConvertor.BindPdf(“c:\testdoc1.pdf”);
pdfConvertor.StartPage = 1;
pdfConvertor.EndPage = 2;
pdfConvertor.DoConvert();
pdfConvertor.SaveAsTIFF(“c:\testdoc1.tiff”);
//pdfConvertor.SaveAsTIFF(mStream); // Actually I need the image as stream for further processing.

Can you please help me find out the actual reason behind it?

Hi Ratheesh,

Could you please share the input PDF file with us, so we could investigate the issue at our end and guide you accordingly?

We’re sorry for the inconvenience.
Regards,

Hi Shahzad,



Please find attached the sample pdf i’m using.



Regards



Ratheesh

Hi Ratheesh,

I have tested this issue at my end using Aspose.Pdf.Kit for .NET 5.5.0, but couldn’t notice any such problem; the output TIFF image contains the two pages of the PDF. Could you please make sure that the version you’re using at your end is 5.5.0? If it is the same version then please share which .NET Framework version you’re using at your end. Also, please provide some more details regarding your working environment i.e. OS, Web/Desktop application etc. So, we could investigate and reproduce the issue using your particular scenario. Which software are you using to view the output TIFF image?

We’re sorry for the inconvenience and looking forward to help you out.
Regards,

Yes Shahzad, I’m using Aspose.Pdf.Kit version 5.5.0.0 itself. My application is a console application created in c#. I tried it with .net framework versions 2.0 and 3.5.

Also I created an ASP.Net web application and a Windows application (C# ) for testing purpose (in .net framework 2.0 and 3.5). But still I’m not able to create a tiff with multiple pages.

I’m viewing the tiff images with Windows Picture and Fax viewer. Can you please tell me any other external software for opening it
(I’m attaching the generated tiff for your reference.)

Development Environment
Microsoft Windows XP Professional
Version 2002
Service Pack 3

Visual studio 2008

Hi Ratheesh,

As I can see, the attached TIFF image also contains two pages. I have viewed the image using Windows Photo Gallery and IrfanView; both of these software shown two pages in the attached TIFF image. Please try any of these two tools or some other tool to view the TIFF image.

I hope this helps. If you have any further questions, please do let us know.
Regards,

Hi Shahzad,

Thanks for your update. I downloaded IrfanView and now I’m able to see all the pages of tiff.
It was my mistake that I didn’t use the proper software for viewing it.

Thanks again for your valuable help.

Regards
Ratheesh

Hi Ratheesh,

I’m glad the issue is resolved at your end and that I could help. If you find any further questions, please do let us know.

Regards,