Hi All,
I am trying to convert 2 mb html file to pdf stream getting below error.
Index was outside the bounds of the array.
at spr.ᜀ(Stream A_0)
at spr.ᜀ(Stream A_0, Boolean A_1)
at spr..ctor(Stream A_0)
at Spire.Pdf.PdfDocument.LoadFromStream(Stream stream)
at ProviderSearchApi.PDFHelper.Htmltopdf(String myModel, String printTmestampstring) in C:\ProviderSearch\PhaseV\API\ProviderSearchApi\ProviderSearchApi\PDFHelper.cs:line 240
Here My code :
myModel = myModel.Replace("cdk-global-scrollblock ratna", "#");
MemoryStream pdfstream = new MemoryStream();
Spire.Pdf.HtmlConverter.Qt.HtmlConverter.Convert(myModel,
pdfstream,
//enable javascript`
true,
//load timeout
100 * 50000,
//page size
PdfPageSize.A4,
//page margins
new Spire.Pdf.Graphics.PdfMargins(20,40),
//load from content type
LoadHtmlType.SourceCode
);
PdfDocument doc = new PdfDocument();
doc.LoadFromStream(pdfstream);
AddTimeStamp(doc, printTmestampstring);
// AddPageNumber(doc);
doc.SaveToStream(pdfstream);
pdfstream.Position = 0;
FileStreamResult filestreamResult = new FileStreamResult(pdfstream, "application/octet-stream");
return filestreamResult;
Please check attaced file and help me on this.
Thanks
Madhu