Aspose.Cells image quality decreased when saving as PDF

Our company has upgraded to Aspose.Cells 8.1.0 from 7.4.3, and we have noticed a problem in the way that the new version of the library handles images in Excel files when they are converted to PDF.

The code we are using to add an image to an XLSX file is as follows, and has not changed:

var range = workbook.Worksheets.GetRangeByName(rangeName);
range.Worksheet.Pictures.Add(range.FirstRow, range.FirstColumn, new MemoryStream(imageBytes));

In the enclosed ZIP file I am attaching two Excel files: source_7_4_3.xlsx and source_8_1_0.xlsx. It is obvious that the two are pretty much the same as pertains to image quality.

However, when we are trying to convert the resulting XLSX file to PDF, the one converted with 8.1.0 is noticeably more blurry. So blurry, in fact, that the image is practically unreadable. The image in question is a barcode, and it is important that it be nice and clear. I am attaching two PDFs that result in converting the above XLSX files to PDF and that demonstrate the difference: converted_7_4_3.pdf and converted_8_1_0.pdf

We are saving the XLSX as PDF with the following code:

var outputStream = new MemoryStream();
var workbook = AsposeImplementation.GetWorkbook(inputStream, null);
workbook.Save(outputStream, Aspose.Cells.SaveFormat.Pdf);

We have also tried setting the PdfSaveOptions as follows:

pdfSaveOptions.SetImageResample(500, 100);
workbook.Save(outputStream, pdfSaveOptions);

But this did not produce any noticeable difference.

For the moment, we have reverted the Aspose.Cells library for our customers, but this is not a sustainable solution. Please let us know if and when we can expect a more permanent fix.


Hi Eva,


Thank you for explaining the problem to us. We have evaluated the presented scenario on our end with different PdfSaveOptions’ settings. In all cases, the PDF generated with latest version of Aspose.Cells for .NET 8.1.0.2 has a blurry image. We have logged this scenario in our bug tracking system for further investigation and correction purposes. The ticket Id for your future reference is CELLSNET-42776. Please spare us little time to properly analyze the problem cause, and to provide a fix (if applicable). In the meanwhile, we will keep you posted with updates in this regard.

Please accept our apologies for your inconvenience.

Hi,

Please try our latest version/fix: Aspose.Cells for Java v8.1.1.3

We have fixed your issue now.

Please see the sample code for your reference:

e.g.

Sample code:

Workbook wb = new Workbook(srcFile);

PdfSaveOptions options = new PdfSaveOptions();

options.SetImageResample(500, 100);

wb.Save(outFile.pdf, options);

Thank you.

Thank you, but can we please have the .NET libraries? We’re using .NET, not Java.

Hi,

Thanks for using Aspose.Cells.

Please download the .NET version from this link: Aspose.Cells for .NET v8.1.1.3.

Thank you for the fix attempt, but this is not it yet. Using the

options.SetImageResample(500, 100);

option, the converted result is indeed better, but not good enough yet. I’m enclosing converted_8_1_1_3.pdf for comparison. Please compare it to converted_7_4_3.pdf that I attached to my original post. In converted_8_1_1_3.pdf, gray areas (artefacts) are visible between the bars of a barcode. In case you may not be familiar with barcodes: the bars need to be absolutely clear and crisp, like they were in Cells 7.4, otherwise the handscanner or OCR software will not recognise them correctly, and this means any automation attached to recognition will not work.

So it seems that unfortunately, Cells 8.1.1.3 does not solve our problem.

Hi Eva,


We are sorry to know that the results generated with the latest version of Aspose.Cells for .NET 8.1.1.3 aren’t up to your expectations. We have re-opened the existing ticket attached to this thread, and requested the core development team to review the API for improvements in this matter. Please spare us little more time for thorough analysis. In the meanwhile, we will keep you posted with updates in this regard.

Hi,

Thanks for your using Aspose.Cells.

Please download and try the latest fix: Aspose.Cells for .NET v8.1.2.2 and let us know your feedback.

I have tested the Excel to PDF conversion with Cells 8.1.2.2 and it is working just fine. The images are crisp and sharp again. This solves our problem. Thank you!

Are these libraries stable / safe to distribute to our customers yet, or should we wait for an official release?


Hi,

Well, you can use this fix (v8.1.2.2) as an official release. It is an intermediate kind of version which is provided as a fix against some bugs/new features full fledged. Normally, this kind of version is posted in the support forums. You can use this version for your requirements; it will behave like an official release. It is to be noted here, our next official release would include all the functionality of the previous fixes (including all the intermediate versions till the next official release).
Thank you.

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


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.