Quantcast
Channel: Aspose.Pdf Product Family
Viewing all articles
Browse latest Browse all 3131

HTML to PDF

$
0
0

Hi I'm trying to convert a HTML string to PDF.

I have a asp.net panel which holds few labels, image and a gridview. I render the panel to get its html string. When I remove the gridview from the panel, the html is getting converted to PDF. But with the gridview the conversion fails and looks to have a memory leak. Below is the code used. Let me know if there is anything that needs to be done to overcome the problem.

Note: The images in the html are not converted into the PDF. A screenshot of the html has to be saved into the PDF. If there is anyother way of doing this, let me know. Thanks!

private

void SaveAsposePDF(StringReader sr, string htmltext)

{

Aspose.Pdf.Generator.

Pdf pdf = new Aspose.Pdf.Generator.Pdf();

Aspose.Pdf.Generator.

Section section = pdf.Sections.Add();

//Aspose.Pdf.Generator.Text txt = new Aspose.Pdf.Generator.Text(section, sr.ReadToEnd());

Aspose.Pdf.Generator.

Text txt = new Aspose.Pdf.Generator.Text(htmltext);

section.Paragraphs.Add(txt);

txt.IsHtmlTagSupported =

true;

string filename = "C:/pdftest/test5.pdf";

pdf.Save(filename);

}


Viewing all articles
Browse latest Browse all 3131

Trending Articles