PDF File Size Comparison when Converting Word DOCX Document on .NET Framework & .NET Core

Recently, we migrated our code from .net framework to .net core. The PDF we were generating using dotnet framework were smaller in size as compare to the ones we’re generating using dotnet core. For some documents, the difference is so significant that it is not acceptable for the client.

I have created a sample document. When I save the same docx as PDF

  • using .net framework - file size is 123 Kb
  • using .net core - file size is 133 Kb

The code is as simple as

string documentPath = "C:\\Data\\Tasks\\PDF_size_mismatch\\test1.docx";
var doc = new Aspose.Words.Document(documentPath);
doc.Save("C:\\Data\\Tasks\\PDF_size_mismatch\\aspose_pdf\\core\\test1.pdf"); 

test1.docx (82.3 KB)

@trizetto,

We have logged this problem in our issue tracking system. The ID of this issue is WORDSNET-22504. We will further look into the details of this problem and will keep you updated on the status of linked issue. We apologize for any inconvenience.

Any update on this ?

@trizetto,

We have completed the analysis of this issue and the root cause has been identified. This issue is related to JPEG image compression. On .NET Framework the JPEG image is saved to PDF as is without processing. On .NET Standard/Core the JPEG image is resaved with SKIA which leads to the 10KB larger image size. Also, there is no built-in way to detect whether image has CMYK color space. So, we also need to investigate the solution for this. The implementation of the fix of this issue has been postponed till a later date. There is no timeframe available at the moment. We will inform you via this forum thread as soon as this issue will get resolved in future and apologize for your inconvenience.

Any update on this?

@trizetto The issue is planed to be fixed in the next 22.2 version of Aspose.Words. We will be sure to inform you once the issue is resolved.

The issues you have found earlier (filed as WORDSNET-22504) have been fixed in this Aspose.Words for .NET 22.2 update also available on NuGet.