I’m sorry to ask this again. I googled as much as I could and worked with the examples in the github and in the support forum but something isnt working right.
Please provide a complete sample on how to convert a multi page pdf to a single tif file.
@aultmike
Please try using the below code snippet in order to convert a PDF into single TIFF file:
var pdfDocument = new Aspose.Pdf.Document(dataDir + "SourseFile.out.pdf");
Aspose.Pdf.Devices.Resolution resolution = new Aspose.Pdf.Devices.Resolution(204, 196);
Aspose.Pdf.Devices.TiffSettings tiffSettings = new Aspose.Pdf.Devices.TiffSettings();
tiffSettings.Compression = Aspose.Pdf.Devices.CompressionType.CCITT4;
tiffSettings.Depth = Aspose.Pdf.Devices.ColorDepth.Format1bpp;
tiffSettings.Brightness = (float)0.1;
Aspose.Pdf.Devices.TiffDevice tiffDevice = new
Aspose.Pdf.Devices.TiffDevice(PageSize.A4, resolution, tiffSettings);
tiffDevice.Process(pdfDocument, dataDir + "SourseFile.pdf.tif");
For more information, please check Convert PDF Pages to One TIFF Image article in the API documentation.
I appreciate you taking the time to respond. I have tried this code and sadly i’m only seeing the first page of the pdf in the tif file. What am i doing wrong? I’m attaching a two page pdf for testing.
Could there be a bug in an earlier version that has been fixed? I’m using 10.2.0.0.MultipagePDF.pdf (32.0 KB)
@aultmike
You are using a quite older version of the API whereas it is always recommended to use the latest version due to more improvements and enhancements. We have tested the same code snippet with 21.2v of the API and did not notice any issue in the generated output TIFF. For your kind reference, an output TIFF is also attached:
MultipagePDF.zip (3.2 KB)
Please try using the latest version of the API (Aspose.PDF for .NET 21.2) with the suggested code snippet and let us know in case you still face any issue.
Please accept my most humble apologies! I discovered my issue was that I was using Windows Photos to view the TIFF file and APPARRENTLY it is unable to display multi-page TIFF files! Once I used Windows Photo Viewer I DID see both pages… Sorry for the confusion.
@aultmike
It is good to know that you were able to sort out the issue. Please keep using our API and let us know in case you need further assistance.