I'm using spire.office to convert html to pdf in my .net core web application. It's working fine in local, but when I deploy the project in Azure. It's not working. When I try to convert a html string to stream using new HtmlConverter plugin and try to write into a pdf. Pdf is not generated successfully and its size is 0kb. can you please tell me what is going wrong!.
Here is my code:
using (MemoryStream pdfstream = new MemoryStream())
{
Spire.Pdf.HtmlConverter.Qt.HtmlConverter.Convert(htmltext,
pdfstream,
true,
10 * 1000,
new SizeF(PdfPageSize.A4),
new Spire.Pdf.Graphics.PdfMargins(sourceFile.MarginLeft, sourceFile.MarginTop, sourceFile.MarginRight, sourceFile.MarginButtom),
LoadHtmlType.SourceCode
);
byte[] pdfarray = pdfstream.ToArray();
File.WriteAllBytes(filename, pdfarray);
}
I have tried this too:
Spire.Pdf.HtmlConverter.Qt.HtmlConverter.Convert(ImgHtml,
filename,
true,
10 * 1000,
new SizeF(PdfPageSize.A4),
new Spire.Pdf.Graphics.PdfMargins(sourceFile.MarginLeft, sourceFile.MarginTop, sourceFile.MarginRight, sourceFile.MarginButtom),
LoadHtmlType.SourceCode
);
PDFs.Add(filename);
It's not generating any file.
Please help me into this.