Free Support Forum -

Converting JPEG or PNG to PDF yields different results in.NET

Good morning everyone,

Yesterday we ran into a very strange issue. I have a web application running .NET Core 2.2 that supports file uploading of JPEGs and PNGs, and the application converts them to PDFs for standardization.

There are a handful of JPEGs and PNGs that are being uploaded that are producing blank PDFs.

I was previously running GroupDocs.Conversion 19.10.0, and upgraded to GroupDocs.Conversion 20.1.0 last night, but still saw no change in behavior.

What’s also very strange is that I downloaded the GroupDocs.Conversion for .NET examples here:

and adjusted the code to convert the exact JPEG and PNG files that I’m having issues with, and it worked when running the example classes.

In my code, my input file is a Stream, coming from Azure Blob Storage, and I refactored the example code to also pull the exact same file from Azure Blob Storage, and again it worked. So it seems to be something very environment specific to my running code.

Has anyone encountered anything like this?

I have tried adding Listeners and Loggers to the Converter, but I don’t see any useful output that shows me that there is an issue.

At this point I feel like I have exhausted my troubleshooting ideas, and I could really use some help here.

Thank you in advance!

1 Like


Can you please share the sample project in which you are facing issue (we’d recommend you to create a new simple application without any dependencies)? If you are not facing same issue in our console application then this could be an environment related.

@atirtahir3 - I was able to reproduce the issue!

I will have a working example project for you shortly.

Using these 2 sample files
sample.jpg (2.5 MB)
sample.png (39.0 KB)

and using the GroupDocs.Conversion.Examples.CSharp.Core example project, make the following changes:

1.) in the GroupDocs.Conversion.Examples.CSharp.Core project, add a NuGet package reference to “EPPlus” version “”

2.) in Visual Studio, expand the NuGet reference to GroupDocs.Conversion, and observe the dependencies that the GroupDocs.Conversion package has
(see screenshot here)
EPPlus.png (5.3 KB)

adding the EPPlus library changes the System.Drawing.Common version dependency from 4.51 to 4.6.0-preview6.19303.8

I am looking to see if upgrading to the latest EPPlus version resolves this issue for me.

I will post again shortly, along with my example project that demonstrates the issue.



@atirtahir3 - see attached. (2.6 MB)

I’m actually observing a couple of different behaviors when you have a license and when you don’t.
This was built using Visual Studio 2017

download the zip file
extract it and open the solution
build the solution and run the application.

after running, go to the “\bin\Debug\netcoreapp2.2\Output” output directory, and for the 2 generated PDF files, note the filesize.

ConvertJpgToPdf\converted.pdf is 38KB
ConvertPngToPdf\converted.pdf is 44KB

  • observe neither PDF file opens correctly.

now place a valid lic file into “bin\Debug\netcoreapp2.2\Resources” and run it again
The .exe should print in the console that the license was set successfully.

again after running, check the output folders, and observe that the filesizes are VERY different

ConvertJpgToPdf\converted.pdf is 2KB
ConvertPngToPdf\converted.pdf is 8KB

I’m not sure if the file size difference is expected because of the missing license including the watermarking or not.

But again observe that neither PDF file opens correctly.

Then the last step would be in Visual Studio, open Manage NuGet Packages for the project, and under Installed, upgrade EPPlus from to, and then re-run the application again

again after running, check the output folders, and observe that the filesizes are VERY different

ConvertJpgToPdf\converted.pdf is 3,315KB
ConvertPngToPdf\converted.pdf is 38KB

observe NOW that both PDF files are valid and can be opened correctly.

so the root cause of the issue appears to be a conflict in System.Drawing.Common, shared between GroupDocs.Conversion and EPPlus

looking at the release history for EPPlus, in their release, they state:
“Added a target build for .NET Core 2.1 (netcoreapp2.1) with System.Drawing.Common 4.6.0-preview6.19303.8”

Whereas in their release, they state:
“Support for .NET Standard 2.1 and updated package references (Removed target netcoreapp2.1).”

and the release has a dependency reference to System.Drawing.Common 4.7.0

ultimately I’m not sure if it’s anything you need to change in GroupDocs.Conversion. However, it appears that GroupDocs.Conversion is NOT COMPATIBLE with System.Drawing.Common version 4.6.0-preview6.19303.8.

I have tested this with GroupDocs.Conversion 19.10. as well as GroupDocs.Conversion 20.1.0

Let me know if there’s anything else I can provide to help support and troubleshoot this.



If you evaluate API in trial mode (without applying a license), you may get unexpected PDF output. Because there are API evaluation limitations.

We are investigating this. Your investigation ID is CONVERSIONNET-3721. As there is any update, you’ll be notified.

awesome. thanks @atirtahir3!

I figured the differences between licensed and unlicensed modes were probably expected, as you noted. Thought it might be helpful to still note them.

For my needs, upgrading EPPlus to their release solves the problem for me, so this is not a critical/blocking issue for me anymore.

Not sure if it potentially impacts others.

Thanks again for the great support.

1 Like


You are welcome.


Your reported issue CONVERSIONNET-3721 is now fixed in API version 20.3.