Free Support Forum - aspose.com

Aspose.Pdf Code not getting excuted after Aspose.Pdf.Document intialization

Hi,

I am facing an issue in which my code stop getting executed after below mentioned line without any exception:

Aspose.Pdf.Document doc = new Aspose.Pdf.Document(mss, objLoadOptions);

What I am trying to do is creating a PDF from a Word Document file using Aspose.Word , which is working fine, and pdf are getting generated, but just after that I am trying to generate a pdf from an HTML string using Aspose.Pdf but the code does not get executed completely. It just stuck in the above-mentioned line and no exception is raised.

Sometimes, the code stops executing and gets stuck while checking the license:

Aspose.Pdf.Document.IsLicensed

The one thing that is fixed is code gets stuck and no pdf gets generated using Aspose.Pdf.

While the whole code is executing fine in the local system and pdf’s are getting generated without any issue. But the same code is not getting executed on the server. I am attaching a sample code which is I have used to generate pdf.Aspose_pdf_Samplecode.zip (1.3 KB)

We have put our solution in the Azure PAAS environment having windows server 2019. Also, we are using a licensed version for both Aspose.Word(v20.5) and Aspose.pdf(v20.5). Can you please look into this and suggest?

Thanks
Pankaj Toshniwal

@PankajToshiwal

Can you please also share the sample HTML string that you are trying to convert into PDF? We will test the scenario in our environment and address it accordingly. Furthermore, please try to test the scenario with 21.5 version of the API before sharing the requested information.

Hi @asad.ali

We have tried our code with the latest v21.5 but nothing changed code still stuck at the same line mentioned earlier:

Aspose.Pdf.Document doc = new Aspose.Pdf.Document(mss, objLoadOptions);

Also, I am attaching sample HTML as you asked. Please look into this.Aspose_pdf_Samplecode (2).zip (3.3 KB)

Thanks
Pankaj Toshniwal

@PankajToshiwal

We noticed that there are references of images inside your HTML. Would you please make sure that those images are present on the server in the same folder where HTML file is placed. In case images are in separate folder, you can specify the path by initializing the HtmlLoadOptions as following:

Aspose.Pdf.HtmlLoadOptions objLoadOptions = new Aspose.Pdf.HtmlLoadOptions("Path to images and resources");

Also, please make sure that your program/web application/web service is authorized/allowed to access the images/resources directory. In case you still face any issue, please let us know.

Hi @asad.ali,

We have tried the solution suggested by you for the Image Path, but the issue still persists. Also, there is no access issue. Please suggest.

Thanks
Pankaj Toshniwal

@PankajToshiwal

We have logged an investigation ticket as PDFNET-49981 in our issue tracking system to further analyze this case. We will look into its details and keep you posted with the status of its correction. Please be patient and spare us some time.

We are sorry for the inconvenience.

Hi @asad.ali,

Do we have any update on ticket PDFNET-49981? Can you please prioritize this as we have a license for Apose.Pdf and need to resolve this issue as soon as possible?

Thanks
Pankaj Toshniwal

@PankajToshiwal

We are afraid that the earlier logged ticket is not yet investigated. We will surely investigate and resolve it on a first come first serve basis. We have recorded your concerns and will surely consider them during ticket resolution. Please give us some time.

We apologize for the inconvenience.

@PankajToshiwal

We performed an initial investigation at our end by testing the case in Azure environment. We were unable to reproduce the issue. Could you please share some more details about your environment and application? Also, please share some steps to reproduce the issue so that we can perform testing accordingly and share our feedback with you.