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

display: table and other table style not working while converting html to pdf

$
0
0

Hi

I am trying to convert a small html file to pdf for poc but style's is not working. I have attached the html file in zip folder. We are using following code for conversion

Aspose.Pdf.Generator.

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

// add the section to PDF document sections collection

Aspose.Pdf.Generator.

Section section = pdf.Sections.Add();

// Read the contents of HTML file into StreamReader object

StreamReader r = File.OpenText(infilename);

//Create text paragraphs containing HTML text

Aspose.Pdf.Generator.

Text text2 = new Aspose.Pdf.Generator.Text(section, r.ReadToEnd());

// enable the property to display HTML contents within their own formatting

text2.IsHtmlTagSupported =

true;

text2.IfHtmlTagSupportedOverwriteHtmlFontSizes =

true;

text2.IfHtmlTagSupportedOverwriteHtmlFontNames =

true;

//Add the text paragraphs containing HTML text to the section

section.Paragraphs.Add(text2);

pdf.HtmlInfo.BadHtmlHandlingStrategy =

BadHtmlHandlingStrategy.TreatAsPlainText;

pdf.HtmlInfo.ShowUnknownHtmlTagsAsText =

true;

//Save the pdf document

pdf.Save(outFileName);

We also tried other APIs but didnot work.

We have full lincense (Fidelity Worldwide). Please suggest best way to handle that.


Viewing all articles
Browse latest Browse all 3131

Trending Articles