Adding an image to a pdf results a in blurry / not readable document

Goal: we start from a pdf containing a nontransparent tiff (white background) and we want to obtain the same pdf containing the same image made transparent.

Procedure: extract the tiff, read it, make transparent, save it in a format that supports background transparency (tiff or png), remove the original image from the pdf, add the new transparent image to the pdf. Please note that the new transparent image has the exact same resolution as the old one.

Problem: while the transparent image looks exactly like the original one, once added to the pdf it looks blurry as if interpolation had been added.

What we would expect: to obtain a resultinf pdf with no blur, like the original one.

Note: readding the original image results in a clear pdf, adding the transparent image in a blurry pdf.

The files for this case can be download from here:
http://www.mechworks.com/ftproot/outgoing/giorgio/aspose_pdf_add_image.zip

Files included in the zip:
tmpimg_0.tif the tiff exctracted fron inside the pdf
tmpimgtransp_0.tif a transparent tiff that looks good, but that, if re-added to the pdf results in a blurry image
tmpimgtransp_0.png same as above, but in png format
a0.tif.pdf the original pdf
pdf original.png what the original pdf looks like at 100% zoom
pdf readded with transparency.png what the pdf wuith transparent image looks like at 100% zoom (blurry)

To add the image we use the command
pdfDocument.Pages[pdfPage].AddImage(tmpTransparentTifPath, pdfDocument.Pages[pdfPage].GetPageRect(false));

We are using Aspose.Pdf. version 8.0.0.0 on .NET 3.0 in C# with VS2010

Hi Luca,


Thanks for contacting support.

I have tried adding tmpimgtransp_0.tif image (using the code snippet specified over Add Image in an Existing PDF File) to one of my sample PDF files but I am afraid I am unable to notice the blur image error. In fact I am getting a different error message while adding the image. Can you please share the code snippet which you are using to extract, making it transparent and then adding it back to PDF file, so that we can again test the scenario in our environment. We are sorry for your inconvenience.

Please download the project from

PDM Software since 1998: Mechworks srl | 404 Error
as a test case.
The projects is C# in VS 2010 for .NET 3.0 64 bit
using Aspose Pdf 8.5.0
The files are generated in the debug folder, an example is already there sjowing how the resulting pdf is blurry while the source .png is not.

Hi Luca,

Thanks for sharing the sample project.

I have tested the scenario with Aspose.Pdf for .NET 8.5.0 over Windows y(x64) in Visual Studio 2010 application, where I have used the following code snippet and I am getting <font color="red">InteropServices.ExternalException (0x80004005): A generic error occurred in GDI+.</font> For the sake of correction, I have logged it in our issue tracking system as PDFNEWNET-35989. I. We will investigate this issue in details and will keep you updated on the status of a correction. We apologize for your inconvenience.

The image is not being added to PDF file so I am unable to verify the transparent image issue.

C#

string emptyPdf = "c:/pdftest/empty.pdf";
string outputPdf = "c:/pdftest/withImage_8_5_0.pdf";
string transparentPng = "c:/pdftest/tmpimgtransp_0.png";

File.Copy(emptyPdf, outputPdf, true);

FileStream ioStream = new FileStream(outputPdf, FileMode.Open, FileAccess.ReadWrite);

// open document
Document pdfDocument = new Document(ioStream);

Console.WriteLine("Add transparent image : " + transparentPng);
Rectangle rect = pdfDocument.Pages[1].GetPageRect(false);

pdfDocument.Pages[1].AddImage(transparentPng, rect);

pdfDocument.Save();

Hi Nayyer,

It is probably a problem with memory or disk space due to the size of the image.
The project, because of memory usage, needs to be compiled for and executed at 64 bits. It is mandatory for us to ensure that images such as the one included in the zip are handled and added correctly.

Hi luca,


Thanks for providing additional information. We’ve changed project targeted platform to 64 bits. Now it working and we’ve noticed image lines distortion issue in resultant PDF file. We have also updated logged issue accordingly. We will keep you updated about the issue progress via this forum thread.

We are sorry for the inconvenience caused.

Best Regards,

Hello Tilal,

my name is Gaetano Tavano and I am one of MechWorks co-founders.
The issue in this thread is jeopardizing our relationship with our customers.
I need to contact of the responsible person from your company since we cannot tolerate other delays.



regards
Gaetano Tavano

Hi Gaetano,

We are sorry for the inconvenience caused.

I am afraid your reported issue is still not resolved due to other priority issues. However, we have recorded your concerns and raised the issue priority. We have also requested our development team to complete the investigation and share an ETA at their earliest.

Moreover fix of an issue depends upon its priority and complexity. We try our best to deal with every customer request in a timely fashion,our developers work on issues on a first come, first served basis. We feel this is the fairest and most appropriate way to satisfy the needs of the majority of our customers.

In addition to normal support option, we have another support service, priority support. That allows you to post your issues in our Priority Support forum and raise the priority of these issues directly with our development teams, if possible, we will then aim to get a resolution to your issue as soon as we can. Many Priority Support customers find that this leads to their issue being fixed in the next release of the software. Please check following links for the details.

Priority Support Policies

[Priority Support FAQs](http://www.aspose.com/corporate/services/support-FAQs.aspx)

Please feel free to contact us for any further assistance.

Best Regards,

The issues you have found earlier (filed as PDFNEWNET-36077) have been fixed in Aspose.Pdf for .NET 8.7.0.


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