Hello everyone!
I'musing the methodfound attheAsposeto convert myhtmlandcssinpdf,
butthe fileis losingformatting// Instantiate an object PDF class
Method:
Aspose.Pdf.Generator.Pdf pdf = new Aspose.Pdf.Generator.Pdf();// add the section to PDF document sections collectionAspose.Pdf.Generator.Section section = pdf.Sections.Add();// Read the contents of HTML file into StreamReader objectStreamReader r = File.OpenText(@"C:/Testes/myArchive.html");//Create text paragraphs containing HTML textAspose.Pdf.Generator.Text text2 = new Aspose.Pdf.Generator.Text(section, r.ReadToEnd());// enable the property to display HTML contents within their own formattingtext2.IsHtmlTagSupported = true;//Add the text paragraphs containing HTML text to the sectionsection.Paragraphs.Add(text2);//Save the pdf documentpdf.Save(@"C:/Testes/ResultOfConversionAspose.pdf");
The input file(html)andoutput(pdf)are attached.
Thanks andhope someone canhelp me.
↧
Problem loading/formatting pdf via html and css inline
↧