Free Support Forum -

Image to PDF: Results in a blank pdf (C# .NET Core)

I’m using the version 19.12.0 of Aspose.Imaging (in Aspose.Total) for .NET Core 3.1 to convert images to pdf. The following simple code is outputting a blank pdf without throwing any exception:

using (Image image = Image.Load("test.png"))
                Aspose.Imaging.ImageOptions.PdfOptions exportOptions = new Aspose.Imaging.ImageOptions.PdfOptions();
                exportOptions.PdfDocumentInfo = new Aspose.Imaging.FileFormats.Pdf.PdfDocumentInfo();
                image.Save("test.pdf", exportOptions);

I have used different files and file formats (jpg, bmp). Saving as SVG or other formats works without problems. Can you please check? Thanks.


I have observed the issue shared by you and request you to please share the source file along with generated output that we may use on our end to log the issue on our issue tracking system.

Hi, here is a sample input and output file from my previously shared code:
test.jpg (584.6 KB)
test.pdf (1.1 KB)

I actually need this feature in the next week, how long will it take to fix it?


I have worked with your sample code and source file on my end using Aspose.Imaging for .NET 19.12 in a .NET based application in Windows 10. I have not been able to observe any corrupt PDF on my end. For your kind reference, generated PDF is also attached. If the issue still persist please provide the sample VS project that you are using along with environment details.

test.pdf (808.8 KB)

Hi there, here is my sample project: (1.3 KB)

VS 2019 16.4.5
Windows 10 Home 64-bit
.NET Core SDK 3.1.101
.NET Core Runtimes:
Microsoft.AspNetCore.All 2.1.15 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.15 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.15 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]


Thank you for sharing the information with us. We shall verify this internally on our end and will get back to you as soon as possible.


I have updated the .NET Core to 3.1 latest version on my end. I am using Visual Studio 2019 installed on Windows 10 x64. I am still unable to reproduce the issue in my environment. The generated PDF has also been attached. (5.0 MB)

test2.pdf (757.1 KB)

Hi, thanks for testing and sharing your solution, which works on my side too.

I have found the cultprint. There is a difference between the dependencies of Aspose.Total (which I’m using) and Aspose.Imaging (which you have used):
Dependencies Aspose.Imaging.jpg (25.6 KB)
Dependencies Aspose.Total.jpg (23.9 KB)

I could reference each Aspose Product individually in the meantime, but there is definitely something wrong with the Aspose.Total package regarding my issue.

I tried referencing each Aspose Product in my project and couldn’t make it work:

Aspose.Pdf needs System.Drawing.Common V4.7.0, which isn’t working with Aspose.Imaging for converting an image to pdf.
If I only reference Aspose.Imaging with System.Drawing.Common V4.5.0 it works.

Alternatively can you give me a solution meanwhile how I can make one pdf out of multiple images using only Aspose.Imaging? Here is what I’m trying to do: (1.6 KB)


I have worked with the sample project shared by you and have been able to reproduce the issue when using both Aspose.PDF and Aspose.Imaging simultaneously in project owing to Aspose.Imaging failing with System.Drawing.Common V4.7.0. An issue with ID IMAGINGNET-3765 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.

For now, I suggest you to please consider only using Aspose.PDF as it allows you to add the images in PDF and saving that. Please visit this documentation link for your kind reference. For more about Aspose.PDF, you may consult Aspose.PDF forum where our respective support team may assist you further.

Thanks for the response, I will try your suggested solution till this gets fixed.


Thank you for your understanding.

The issues you have found earlier (filed as IMAGINGNET-3765) have been fixed in this update.