We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Issue with latest version of Aspose.Pdf dll

Hi Team,


I am having an issue while using the latest version (17.2.0.0) of Aspose.Pdf dll in my application.
I have a SharePoint 2013 application in which I have created a custom webpart. I have the following code in a button click event.
I have added the reference of Aspose.Pdf.dll from GAC (.Net framework 4.5).

Aspose.Pdf.License license = new Aspose.Pdf.License();
license.SetLicense(ConfigurationManager.AppSettings[strPDFLicensePath]);
Aspose.Pdf.Generator.Pdf _pdf2 = new Aspose.Pdf.Generator.Pdf();
_pdf2.Security = new Aspose.Pdf.Generator.Security();
_pdf2.Security.IsCopyingAllowed = false;
_pdf2.Security.IsContentsModifyingAllowed = false;
_pdf2.Security.IsAnnotationsModifyingAllowed = false;
_pdf2.Security.IsScreenReadersAllowed = false;
_pdf2.Security.IsFormFillingAllowed = false;
_pdf2.Security.Is128BitsEncrypted = true;
_pdf2.PageSetup.Margin.Right = 98;// r = 50; no pagewidth;
_pdf2.PageSetup.Margin.Left = 75;//70,68
string strHTML = “

PDF text is here!

”;
_pdf2.BindHTML(strHTML);
_pdf2.Save(“D:\TestPDF.pdf”);
I am getting the exception at the line _pdf2.BindHTML(strHTML).
Exception: Could not load file or assembly ‘Aspose.HtmlOld, Version=17.2.0.0, Culture=neutral, PublicKeyToken=716fcc553a201e56’ or one of its dependencies. The system cannot find the file specified.

Note that the same code work fine in .Net Console application. But, with WebApplication, I am facing this issue.
Can you please suggest on what could be missing?
Any quick help on this is much appreciated.

Hi There,


Thanks for contacting support.

I tried to add HTML in PDF document using the following code and noticed that it generates exception when we initialize HtmlFragment Class.

Aspose.Pdf.Document doc = new Aspose.Pdf.Document();<o:p></o:p>

Aspose.Pdf.HtmlFragment frag = new Aspose.Pdf.HtmlFragment(

PDF text is
here!

);<o:p></o:p>

var page
= doc.Pages.Add()<o:p></o:p>

page.Paragraphs.Add(frag);

doc.Encrypt("userpwd", "ownerpwd", 0, Aspose.Pdf.CryptoAlgorithm.AESx128);

doc.Save("TestPDFC.pdf");


Moreover I have noticed that in your code you are using old Aspose.Pdf.Generator approach which is going to be obsolete soon. Please note that it is recommended to use new DOM (Aspose.Pdf) approach. In the above code I have used new DOM approach to add HTML inside the PDF. You may check "Working with Aspose.Pdf" section in our API documentation for reference.


Therefore the issue is regarding new DOM approach and I have logged it as PDFNET-42268 in our issue tracking system. We will further look into this and will keep you updated on the status of its resolution. Please be patient and spare us a little time. We are sorry for the inconvenience.


Best Regards,

Hi Team,


We even tried below code as per the new DOM approach:

string strHTML = “

PDF text is here!

”;
HtmlLoadOptions htmlLoadOptions = new HtmlLoadOptions();
htmlLoadOptions.PageInfo.Margin.Bottom = 10;
htmlLoadOptions.PageInfo.Margin.Top = 20;
Aspose.Pdf.Document doc = new Aspose.Pdf.Document(new MemoryStream(System.Text.Encoding.UTF8.GetBytes(strHTML)), htmlLoadOptions);
doc.Save(“output.pdf”);

But, exception is thrown at the line
Aspose.Pdf.Document doc = new Aspose.Pdf.Document(new MemoryStream(System.Text.Encoding.UTF8.GetBytes(strHTML)), htmlLoadOptions);

Exception is:
Could not load file or assembly ‘Aspose.HTML, Version=17.2.0.0, Culture=neutral, PublicKeyToken=716fcc553a201e56’ or one of its dependencies. The system cannot find the file specified.

Awaiting the quick fix from your end.

Hi There,


Thanks for your feedback and sharing more details. I have tried to add HTML to new PDF document using the code snippet which you just have shared and I am sorry that it threw the exception at the same line which you have pointed out.

I already have generated a ticket for this issue in our issue tracking system as PDFNET-42268. For the sake of detailed investigation I have also intimated the Product Team regarding this exception as well. We really appreciate your patience in this regard. Please spare us a little time.

We are sorry for the inconvenience.

Best Regards,

Hi Team,


Do you have any timelines for the resolution of this issue?
We are held up with our Go-live because of this issue.
Can we expect a resolution by end of this week?

Hi,


Thanks for contacting support.

As we recently have noticed earlier reported issue, so its pending for review and is not yet resolved. However the product team will surely consider investigating/fixing it as per development schedule and as soon as we have some definite updates regarding its resolution, we will let you know. Please be patient and spare us little time. We are sorry for this delay and inconvenience.