Getting Exception of type 'System.Exception' was thrown

CaptureAsposeError.PNG (56.6 KB)

Getting System.Exception whenever I have use Aspose.PDF.Document Class.

@npprajapapati

Could you please attach your input PDF file here for testing? We will investigate the issue and provide you more information on it.

CS25012211314531_25-01-2022.pdf (51.3 KB)

Please Refer this PDF
Aspose.Pdf throws error when we use dot net SDK 6.0.
Attach code also for your reference

var license = new Aspose.Pdf.License();

            license.SetLicense("Aspose.Total.lic");
           
            //Set the properties for PDF file page format         
            HtmlLoadOptions objLoadOptions = new HtmlLoadOptions();
            objLoadOptions.PageInfo.Margin.Bottom = 10;
            objLoadOptions.PageInfo.Margin.Top = 5;
            objLoadOptions.PageInfo.Margin.Left = 22;
            objLoadOptions.PageInfo.Margin.Right = 22;

            var htmlForPdf = AssignValuesToHtml(data);
            if (!string.IsNullOrEmpty(htmlForPdf))
            {
                //Load HTML string into MemoryStream using Aspose document class
                Document doc = new Document(new MemoryStream(Encoding.UTF8.GetBytes(htmlForPdf)), objLoadOptions); // this line throw exception in .net SDK 6.0

@npprajapapati

Your code imports the HTML into Aspose.PDF DOM. However, you have shared the PDF file as input. To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input HTML.
  • Please create a standalone console application (source code without compilation errors) that helps us to reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we will start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip and upload them.