I just tried the code out, and I can read in DOCX files and output them to PDF/TIFF/JPEG without issue. But when I read in a PDF file, and try to output DOCX/TIFF/JPEG, only the DOCX file works. The TIFF and JPEG files are corrupted and cannot be opened. Is there a glitch in the demo, or am I missing something? Thankyou in advance.
Hello Paul,
Thanks for the prompt reply. I have tried it with two PDFs, both have the same results. Both are attached.
Hi Paul,
Thanks for sharing sample documents. We are unable to replicate the issue while testing the scenario with your sample document over Windows 7 64 bit, VS2010 and Aspose.Pdf for NET 9.4.0 4.0 .Net Framework dll. However, your second PDF document can not be processed with the evaluation version as it contains 6 pages. In evaluation mode at most four elements of any collection can be viewed/updated. You may request a temporary license to evaluate our product withoutany limitation. Hopefully your issue will be resolved.
TIF Image
var savePdfDocument = new Aspose.Pdf.Document(myDir + "SomeLayout.pdf");
var resolution = new Resolution(300);
var tiffSettings = new TiffSettings
{
Compression = CompressionType.LZW,
//Depth = Aspose.Pdf.Devices.ColorDepth.Format8bpp,
Shape = ShapeType.None,
SkipBlankPages = true
};
var tiffDevice = new TiffDevice(resolution, tiffSettings);
var saveName = myDir + "SomeLayout" + ".tif";
tiffDevice.Process(savePdfDocument, saveName);
JPEG Image
var pdfDocument = new Document(myDir + "SomeLayout.pdf");
for (int pageCount = 1; pageCount <= pdfDocument.Pages.Count; pageCount++)
{
using (FileStream imageStream = new FileStream(myDir + string.Format("{0}_page{1}.jpg", "Output", pageCount), FileMode.Create))
{
var resolution = new Resolution(300);
var jpegDevice = new JpegDevice(resolution);
//convert a particular page and save the image to stream
jpegDevice.Process(pdfDocument.Pages[pageCount], imageStream);
//close stream
imageStream.Close();
}
}
Please feel free to contact us for any further assistance.
Best Regards,