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 page.Paragraphs.Add(img); // 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.