Setup
Host: Docker using image mcr.microsoft.com/dotnet/aspnet:6.0-focal
Dependencies
- Aspose.Pdf.Drawing 23.2.0
- Aspose.Drawing 23.2.0
- SkiaSharp.NativeAssets.Linux.NoDependencies 2.88.3
- Microsoft.Extensions.DependencyModel 6.0.0
Code
input.jpg (318.4 KB)
using PdfDocument = Aspose.Pdf.Document;
// Initialize new PDF document
var doc = new PdfDocument();
// Add empty page in empty document
var page = doc.Pages.Add();
var image = new Image();
image.File = inputFilename;
// Add image on a page
page.Paragraphs.Add(image);
// Save output PDF file
doc.Save(outputFilename);
Error
System.ArgumentNullException: Value cannot be null. (Parameter 'key')
at System.Collections.Generic.Dictionary`2.FindValue(TKey key)
at System.Collections.Generic.Dictionary`2.TryGetValue(TKey key, TValue& value)
at #=z_8VKtooG4KReYBFLI5rHcs_089uDuyyUzw==.#=zMuYqLfU=(#=zqx$9Wws= #=zXEpC3Yw=)
at #=zvP80FvsbIYWEjk4y0$u1K7fSruiME656xQ==.#=zNPz7HEXCS7Yb`2.#=zLow$MvdxYw03(#=zqx$9Wws= #=zXEpC3Yw=, #=z3HVD8Cg=& #=zFb9tWHU=)
at #=z1lnBDC7qRoFdSgq65xD2gZ$GrZ3ueiM1sx8BsF8=.#=zcM3ONGJCpQTq(#=zPXg6mQVFOnGPCqr9NpHT7TlK9AG2 #=zHRtK9WqhS0SP)
at #=zIRn9vQD5BlbDNj46oHuAkSeDkPQ_998t4iOb$RAi3jF1.#=zXkqkhcWt6bom()