I have created an ASP.NET MVC application (.NET Framework 4.6.2), and using HiqPDF (Version - 10.17.0) to generate PDF from HTML.
Following is the code:
public static string ConvertHtmlToPdf(string pdfContentFilePath, string pdfOutputPath)
{
try
{
string fileName = pdfOutputPath + DateTime.Now.ToString("ddMMyyyyHHmmssf") + ".pdf";
string pdfContents = System.IO.File.ReadAllText(pdfContentFilePath);
HtmlToPdf htmlToPdfConverter = new HtmlToPdf();
htmlToPdfConverter.TrimToBrowserWidth = true;
PdfDocument pdfDocumentObject = htmlToPdfConverter.ConvertHtmlToPdfDocument(pdfContents, null);
pdfDocumentObject.WriteToFile(fileName);
return fileName;
}
catch(Exception ex)
{
throw ex;
}
}
I am trying with a very basic HTML (Only one bold text, no image, no other formatting).
This code is working fine on local environment, and generates PDF successfully. However, when I deploy this project on Azure, I am getting following error:
"Navigation Timeout"
I tried various other methods of the "HtmlToPdf" class, but getting the same error.
Can anyone please suggest what could be the reason, and how to fix this issue?
Any help on this will be much appreciated.