Basically, when converting the attached HTML file. (It wouldnt let me upload it as html so I have changed it to a .txt) it changes the layout and font size of some of the text in the conversion to pdf.
Hi there,
Document doc = new
Document(myDir + “Html_layoutfont_issue.html”,
new HtmlLoadOptions());<o:p></o:p>
doc.Save(myDir + "Html_layoutfont_issue.pdf");
Please feel free to contact us for any further assistance.
Best Regards,
This is my code, I am having the exact same problem as Kaser47…Please can you help me get to the bottom of it.
public byte[] ConvertHtmlToPdf(string html)
{
using (var outputStream = new MemoryStream())
{
var pdf = new Aspose.Pdf.Generator.Pdf();
pdf.PageSetup.PageWidth = 1250;
pdf.PageSetup.Margin = new MarginInfo() { Bottom = 5, Top = 5, Left = 5, Right = 5 };
Aspose.Pdf.Generator.Section section = pdf.Sections.Add();
var text = new Aspose.Pdf.Generator.Text(section, html);
text.IsHtmlTagSupported = true;
//text.IsHtml5Supported = true;
//text.UseTextInfoStyle = true;
//text.IfHtmlTagSupportedOverwrightHtmlFontNames = true;
//text.IfHtmlTagSupportedOverwrightHtmlFontSizes = true;
section.Paragraphs.Add(text);
pdf.Save(outputStream);
return
outputStream.ToArray();
}
}
I can assure you that the fonts are installed on the host machine because we also use the word to pdf conversion and that works fine no problem. I have used the exact same html document and just saved it as a docx, run it through the word conversion and it works without an issue. Hence why I think theres an issue with your PDF conversion.
Its an issue with the H1 field.
Hi Ash,
rhodesash55:This is my code, I am having the exact same problem as Kaser47…Please can you help me get to the bottom of it.public byte[] ConvertHtmlToPdf(string html)
{
using (var outputStream = new MemoryStream())
{
var pdf = new Aspose.Pdf.Generator.Pdf();
pdf.PageSetup.PageWidth = 1250;
pdf.PageSetup.Margin = new MarginInfo() { Bottom = 5, Top = 5, Left = 5, Right = 5 };
Aspose.Pdf.Generator.Section section = pdf.Sections.Add();var text = new Aspose.Pdf.Generator.Text(section, html); text.IsHtmlTagSupported = true; //text.IsHtml5Supported = true; //text.UseTextInfoStyle = true; //text.IfHtmlTagSupportedOverwrightHtmlFontNames = true; //text.IfHtmlTagSupportedOverwrightHtmlFontSizes = true; section.Paragraphs.Add(text); pdf.Save(outputStream); return outputStream.ToArray(); } }</div></BLOCKQUOTE></font></div><div><font face="Arial" size="2"><br></font></div><div><div><font face="Arial" size="2"><br></font></div><div style=""><font face="Arial" size="2">Thanks for your inquiry. As suggested above please use new Dom Approach for <a href="http://www.aspose.com/docs/display/pdfnet/Convert+HTML+to+PDF+Format">HTML to PDF conversion</a> instead old generator(Aspose.Pdf.Generator). Please use it will resolve the issue. conversion.</font></div><div><font face="Arial" size="2"><br></font></div><div><font face="Arial" size="2">We are sorry for the inconvenience caused.</font></div><div><font face="Arial" size="2"><br></font></div><div><font face="Arial" size="2">Best Regards,</font></div></div>
Kaser47:I can assure you that the fonts are installed on the host machine because we also use the word to pdf conversion and that works fine no problem. I have used the exact same html document and just saved it as a docx, run it through the word conversion and it works without an issue. Hence why I think theres an issue with your PDF conversion.Its an issue with the H1 field.