Hi,
Our HTML file has more number of pages around 100 pages, I’m trying to convert HTML to PDF file getting memory out of exception, please give me a solution to resolve this issue.
Please find below snippet code
System.Text.StringBuilder htmlContentPDF = new System.Text.StringBuilder();
string linePDF;
using (System.IO.StreamReader htmlReaderPDF = new System.IO.StreamReader(@“F:/eVReports-ca-23_07_2018_01_28_47.html”))
{
while ((linePDF = htmlReaderPDF.ReadLine()) != null)
htmlContentPDF.Append(linePDF);
}
MemoryStream stream = new MemoryStream(System.Text.Encoding.UTF8.GetBytes(htmlContentPDF.ToString()));
HtmlLoadOptions options = new HtmlLoadOptions();
options.PageInfo.Width = Aspose.Pdf.PageSize.A4.Width;
options.PageInfo.Height = Aspose.Pdf.PageSize.A4.Height;
options.PageInfo.Margin.Left = 10;
options.PageInfo.Margin.Right = 10;
options.PageInfo.Margin.Top = 10;
options.PageInfo.Margin.Bottom = 10;
Document pdfDocument = new Document(stream, options);
Thanks,