Hi
I’m trying to save an HTML email as PDF, but Aspose.PDF throws System.ArgumentException “value”. Here is the code to replicate the issue.
Code:
string b = "<p class=\"MsoNormal\" style=\"text-align: justify;\"><span style=\"font-family: 'Bell MT', serif;\">Dear Mr Test</span></p>";
byte[] correspondenceBytes = Encoding.UTF8.GetBytes(b);
string fileName = "c:\temp\test.pdf";
using (MemoryStream ms = new MemoryStream(correspondenceBytes))
{
Document document = new Document(ms, new HtmlLoadOptions()); // Exception
document.Save(fileName, SaveFormat.Pdf);
}
Stack trace:
System.ArgumentException was unhandled by user code
HResult=-2147024809
Message=value
Source=Aspose.Pdf
at . .TryGetValue(String token, & value)
at . .GetValue(String )
at . . [T]()
at . . [T]()
at . . ()
at . .Initialize( , )
at . ..ctor( , , )
at . ..ctor( , )
at . . ( )
at . . ( )
at . . ( )
at . . ( )
at . . ( )
at . . ( )
at . . ( )
at . . ( )
at . . ( )
at . .Convert( , )
at . .Convert(Stream , )
at . .Convert(Stream , Document , , HtmlLoadOptions )
at Aspose.Pdf.Document. (Stream , LoadOptions )
at Aspose.Pdf.Document..ctor(Stream input, LoadOptions options)
If I remove “background-attachment” etc. from style then PDF is generated.
Thanks
Sourabh
Aspose.Pdf 10.9.0.0