Image in PDF file does not get same resolution and size

Hi there:


We are using following sample to put a image in a PDF file.
After PDF file is created, the image embedded in PDF file has different size and resolution.
(It is smaller and not as clear as original image under 100% PDF view)
Original image is attached.

Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();

//Create a section in the Pdf object
Aspose.Pdf.Generator.Section sec1 = pdf1.Sections.Add();

//Create an image object in the section
Aspose.Pdf.Generator.Image image1 = new Aspose.Pdf.Generator.Image(sec1);

//Add image object into the Paragraphs collection of the section
sec1.Paragraphs.Add(image1);

//Set the path of image file
image1.ImageInfo.File = “C:/temp/abcd.png”;

//Set the type of image using ImageFileType enumeration
image1.ImageInfo.ImageFileType = Aspose.Pdf.Generator.ImageFileType.png;
//Set image title
image1.ImageInfo.Title = “Image”;
//Save the Pdf
pdf1.Save(“c:\temp\test.pdf”);

Hi Shelley,


Thanks for contacting support.

I have tested the scenario using Aspose.Pdf for .NET 8.2.0 where I have used the following code snippet to add the image in its original dimensions. For your reference, I have also attached the resultant PDF generated over my end.

[C#]

Aspose.Pdf.Generator.Pdf
pdf1 = new Aspose.Pdf.Generator.Pdf();<o:p></o:p>

//Create a section in the Pdf object

Aspose.Pdf.Generator.Section sec1 = pdf1.Sections.Add();

//Create an image object in the section

Aspose.Pdf.Generator.Image image1 = new Aspose.Pdf.Generator.Image(sec1);

//Add image object into the Paragraphs collection of the section

sec1.Paragraphs.Add(image1);

//Set the path of image file

image1.ImageInfo.File = "C:/pdftest/abcd.png";

// load the image to BMP object

Bitmap bmp = new Bitmap("C:/pdftest/abcd.png");

// set the image width information

image1.ImageInfo.FixWidth = bmp.Width;

// set the image Height information

image1.ImageInfo.FixHeight = bmp.Height;

//Set the type of image using ImageFileType enumeration

image1.ImageInfo.ImageFileType = Aspose.Pdf.Generator.ImageFileType.Png;

//Save the Pdf

pdf1.Save(“c:\pdftest\Image_Dimentions_test.pdf”);

Hi there:


Thanks for response so quickly.
I have checked your attachment file and code.
Your attached PDF file contains the same size and resolution that I created myself.
It doesn’t appear the same size and resolution in your PDF file with original image file.
In fact it looks bigger and less clear then original image.
What we are trying to accomplish is to make PDF file contain the best resolution and clear image possible.
We are currently using a tool(ABCPDF) to generate our PDF file, this tool doesn’t give us the best result.
So we are trying other different tools(including Aspose.PDF).
I have attached some screenshots.

1.image display in your PDF file.
2.image display in Paint tool.
3.original image.

I don’t think 1 and 2 looks the same.
Is your attached PDF file the best quality outcome Aspose.PDF can present in terms of having image in PDF file?

Thanks

Jim

Hi Shelley,


<span style=“font-size:10.0pt;font-family:“Arial”,“sans-serif””>I
have tested the scenario and I am able to reproduce the same problem. For the
sake of correction, I have logged it in our issue tracking system as PDFNEWNET-35619. We
will investigate this issue in details and will keep you updated on the status
of a correction. <o:p></o:p>

We apologize for your inconvenience.

Hi Nayyer,

sorry for popping up this old thread, but we’re getting the same problem, so - in order to complete our work - we need to know whether this issue has been solved in some recent version of Aspose Pdf.

Could you please give it a check?

Thanks in advance.

Nayyer, please ignore my previous message.

We have proceeded with another test, and now it seems to work.

Thanks for your patience.

elettronica1:
Nayyer, please ignore my previous message.

We have proceeded with another test, and now it seems to work.

Thanks for your patience.
Hi Elett,

Thanks for the acknowledgement.

We are glad to hear that your problem is resolved. Please continue using our API's and in the event of any further query, please feel free to contact.