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

Free Support Forum - aspose.com

Aspose.PDF exports corrupted graphics files- trial version

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.


Aspose.Pdf.Document d2 = new Aspose.Pdf.Document(@“C:\1\SomeLayout.pdf”);
d2.Save(@“C:\1\test0.docx”, Aspose.Pdf.SaveFormat.DocX); <–Works
d2.Save(@“C:\1\test0.tiff”); <–Creates corrupt file
d2.Save(@“C:\1\test0.jpeg”); <–Creates corrupt file

Aspose.Words.Document d4 = new Aspose.Words.Document(@“C:\1\mydoc.docx”);
d4.Save(@“C:\1\test2.pdf”, Aspose.Words.SaveFormat.Pdf); <–Works
d4.Save(@“C:\1\test2.tiff”); <–Works
d4.Save(@“C:\1\test2.jpeg”); <–Works

Hello Paul,


Thanks for using our API’s.

Can you please share the source PDF file causing this problem so that we can test the scenario at our end. We are sorry for this inconvenience.

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 evaluation version as it contains 6 pages. In evaluation mode at most four elements of any collection can be viewed/updated. You may request for 30
days temporary license to evaluate our product without
any 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,