Hi guy
we encounters a problem while converting html into pdf base on Aspose.PDF which version is 22.11 . the html file as bellow zipped attachment .
task-544.zip (593.2 KB)
the code as bellow .
var fileFullPath = "d:\\1.pdf";
var sourceFullPath = "d:\\task-544.html";
// Create a HTML LoadOptions
HtmlLoadOptions options = new HtmlLoadOptions();
// Set Print or Screen mode
options.HtmlMediaType = HtmlMediaType.Print;
var pdfOptions = new Aspose.Pdf.PdfSaveOptions();
// Initialize document object
Document document = new Document(sourceFullPath, options);
// Save output PDF document
document.Save(fileFullPath ,pdfOptions );
the exception detail as bellow :
System.ArgumentNullException: Value cannot be null.
Parameter name: key
at System.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument)
at System.Collections.Generic.Dictionary2.FindEntry(TKey key) at System.Collections.Generic.Dictionary
2.TryGetValue(TKey key, TValue& value)
@wengyeung
With the library version 24.06 the code
var fileFullPath = dataDir + "1-out.pdf";
var sourceFullPath = dataDir + "task-544.html";
// Create a HTML LoadOptions
var options = new HtmlLoadOptions();
// Set Print or Screen mode
options.HtmlMediaType = HtmlMediaType.Print;
var pdfOptions = new Aspose.Pdf.PdfSaveOptions();
// Initialize document object
var document = new Document(sourceFullPath, options);
// Save output PDF document
document.Save(fileFullPath, pdfOptions);
works without exceptions. The result is valid.
I am attaching a document obtained when using the library without a license.
1-out.pdf (1.7 MB)
Dear guy
the problem is gone after we upgrade the aspose.pdf into Ver. 24.05 , This topic can be closed .
Thank you .
@wengyeung
I am glad that your issue has been solved
Hi guy ,
we check html documents from client and found one document throwed the error ‘Object reference not set to an instance of an object.’ while creating instance of PDF by using newest version 24.08 . bellow is the document .
audit-1005 - 2 1.7z (22.9 KB)
@wengyeung
I have reproduced the problem - I will create a task for the development team to fix it.
@wengyeung
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): PDFNET-57983
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.