Hi,
I have a html template with relative path referencing of CSS
I created a pdf with HTML template but the style were missing in PDF.
Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();
Aspose.Pdf.Generator.Section section = pdf1.Sections.Add();
section.PageInfo.PageWidth = Aspose.Pdf.Generator.PageSize.A4Width;
section.PageInfo.PageHeight = Aspose.Pdf.Generator.PageSize.A4Height;
Aspose.Pdf.Generator.MarginInfo marginInfo = new Aspose.Pdf.Generator.MarginInfo();
marginInfo.Top = 10;
marginInfo.Bottom = 10;
marginInfo.Left = 5;
marginInfo.Right = 5;
section.PageInfo.Margin = marginInfo;
StreamReader r = File.OpenText(@“c:\users\xxx\PDFGeneration\PDFGeneration\HTMLTemplate\ReceiptTemplate.html”);
Aspose.Pdf.Generator.Text text2 = new Aspose.Pdf.Generator.Text(section, r.ReadToEnd());
text2.IsHtmlTagSupported = true;
section.Paragraphs.Add(text2);
pdf1.HtmlInfo.ExternalResourcesBasePath = @“path to css”;
//Save the pdf document
pdf1.Save(“HTML2pdf.pdf”);
Am i missing some thing here. I am using a trial version dll. Is it something to do with that?
Regards,
Kannappan