Pdf to Image Conversion-generating black images

Hi,


when i try to convert a pdf doc page (specification-1.3) to image.The resulting images are black.

we are using Aspose.Pdf version 7.0.does it support versions below 1.4?

Please look at the attached input pdf file(ver.1.3).

I’m using the below code.

private static void GenerateImageFromPDF(Int32 pageNumber, string inputFilePath, string outputFilepath)
{
System.Drawing.Size resize = new System.Drawing.Size(200, 300);
Aspose.Pdf.License _licensePdf = new Aspose.Pdf.License();
_licensePdf.SetLicense(“Aspose.Total.lic”);

using (Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(inputFilePath))
{
pdfDocument.Validate(“test.txt”, Aspose.Pdf.PdfFormat.);
Aspose.Pdf.Devices.Resolution resolution = new Aspose.Pdf.Devices.Resolution(80);
Aspose.Pdf.Devices.PngDevice pngDevice;
pngDevice = new Aspose.Pdf.Devices.PngDevice(resize.Width, resize.Height);
if (resize.Height == 0 || resize.Width == 0)
{
pngDevice = new Aspose.Pdf.Devices.PngDevice(resolution);
}
else
{
pngDevice = new Aspose.Pdf.Devices.PngDevice(resize.Width, resize.Height);
}
var directory = Path.GetDirectoryName(outputFilepath);
if (!Directory.Exists(directory))
{
Directory.CreateDirectory(directory);
}

// Convert a particular page and save the image to stream
pngDevice.Process(pdfDocument.Pages[pageNumber], outputFilepath);

}
}

Thanks,
Lalitya

Hi Lalitya,


Thanks for your inquiry. I have tested the scenario with Aspose.Pdf for .NET 10.5.0 and unable to replicate the issue. Please download and try latest version of Aspose.Pdf for .NET, it will resolve the issue.

Best Regards,

Hi Tilal,


Again thanks for the quick response.I really appreciate it.

So,can we migrate from Aspose.Pdf from 7.0 to latest version with out having any breaking changes(just replace the dlls)?

Because our codebase is huge and it’s a huge effort for migration if we have breaking changes in our API, unfortunately we didn’t wrap the Aspose functionality and its spread across the code.

Thanks,
Lalitya

Hi Tilal,


I tested with latest version dll’s and its working.

Our only concern is the effort in migration.

Recently we migrated from 5 to 7 instead of 8 because some API’s are deprecated.

eg.

TextFragmentAbsorber
GoToAction



Thanks,
Lalitya

Hi Lalitya,


Thanks for your feedback. Please note we maintain a single code base of Aspose Components, so all the fixes and new features/enhancements are implemented in latest version of DLL. So it is suggested to use latest version of Aspose.Pdf for .NET as we cannot provide any hotfix for older versions.

In reference to migration to latest version, please check documentation link for migrating from older version of Aspose.Pdf. There are no major changes you can check API changes section for the purpose. We will be more than happy to extend our support in this course of migration.

Moreover, your both mentioned objects are available in latest release.

Best Regards,