We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How come that a total size of 1.3M of (BINARY) images becomes a 31M pdf?

We are converting jpg and png images to PDF with Aspose.

When converting with the following code, the size of the output file becomes 31.5M whe the starting total size of all png images together was just 1.3M. How can that even be? And images are binary (black and white).

I am attaching the input png images (it does not contain any private material). Output is just too big.

Decreasing the image quality is not an option since it totally destroys the conversion of low quality images and triples the time the conversion needs to process them.


var doc = new Aspose.Pdf.Document();
foreach (DsDocumentAttachment.TFileDataRow row in filesInCurrentAttachment.Rows)
// custom get stream of each image from DB
var imageStream = new MemoryStream(newDocument.fMain.Attachment_GetFileData(row.FileDataID, true, true, true, false).Blob);

var bitmap = new Bitmap(imageStream);
if (bitmap != null)
var page = doc.Pages.Add();
page.PageInfo.Margin.Top = page.PageInfo.Margin.Right = page.PageInfo.Margin.Bottom = page.PageInfo.Margin.Left = 0;
page.PageInfo.Height = bitmap.Height;
page.PageInfo.Width = bitmap.Width;
var pdfImage = new Aspose.Pdf.Image();
pdfImage.ImageStream = imageStream;
doc.Convert(new MemoryStream(), PdfFormat.PDF_A_1B, ConvertErrorAction.Delete);
var returnStream = new MemoryStream();
// saving stream as an array (returnStream.ToArray()) to DB

document.zip (1.3 MB)


Thanks for contacting support.

We were able to observe the similar results while testing the scenario in our environment using Aspose.PDF for .NET 18.12. We have logged an investigation ticket as PDFNET-45815 in our issue tracking system for the sake of detailed investigation. As soon as we have some definite updates regarding resolution of the ticket, we will let you know. Please be patient and spar us little time.

We are sorry for the inconvenience.

Thank you for the quick answer. I hope you’ll manage to fix this.


We will definitely look into details of the issue and let you know in case of additional updates. Please spare us little time.