Converting PNG to PDF produces large file size


I have a simple need to convert a PNG to PDF. However, the following code (under Aspose.PDF 21.3) converts a 270 KB PNG to a 1.7 MB PDF - a 6x increase!

// Create new document
var pdf = new Aspose.Pdf.Document();

// Add a page
var page = pdf.Pages.Add();

// Create image object
var img = new Aspose.Pdf.Image();
img.File = "image.png"; // 270 KB

// Add image to page

// Save PDF
pdf.Save("output.pdf"); // 1.7 MB!

image.png (269.9 KB)

This problem gets worse if adding multiple images.

I have seen other responses where the advice is to reduce image quality, but I do not want to reduce quality of the PNG - I just want to use the original image, but without huge size increase. I have tested in 2 other libraries and they produce a PDF about the same size as the original image, without altering the original image at all.

Can you please advise how to add an image without causing size of PDF to become excessive.

Thank you


I have been able to observe the issue on my end and a ticket with ID PDFNET-49741 has been created in our issue tracking system to further investigate the issue. We will share the feedback with you as soon as it will be shared.