Hi,
I have below code
indent preformatted text by 4 spaces
public static void inLineCSSForFormInst(string outputPath, string formHTML, string formInstanceID)
{
outputPath += “InCSS.pdf”;
string appPath = clsConfigurationSettings.appFilePath(sConnStr);
HtmlDocument doc = new HtmlDocument();
doc.LoadHtml(File.ReadAllText(appPath + "RenderForm.aspx"));
StringBuilder mainHTML = new StringBuilder();
mainHTML.AppendLine("<head>");
// All page CSS
mainHTML.AppendLine(Styles());
// render Form Page style
foreach (HtmlNode linkNode in doc.DocumentNode.Descendants("style"))
{
mainHTML.AppendLine(linkNode.OuterHtml);
}
mainHTML.AppendLine("</head>");
mainHTML.AppendLine(formHTML);
formHTML = mainHTML.ToString();
File.WriteAllText("document.html", formHTML);
using (var document = new Aspose.Html.HTMLDocument(formHTML, "."))
{
// Create the PDF Device and specify the output file to render
using (var device = new Aspose.Html.Rendering.Pdf.PdfDevice(outputPath))
{
device.Options.PageSetup.AnyPage.Margin = new Aspose.Html.Drawing.Margin(0, 0, 0, 0);
device.Options.PageSetup.AdjustToWidestPage = true;
device.Options.Css.MediaType = MediaType.Screen;
// Render HTML to PDF
document.RenderTo(device);
}
}
}
But problem is as per HTML PDF is not rendering correctly. I need same as HTML view.
Can you help on this
attached is my HTML and PDF output
document.zip (399.2 KB)