1

I am using SelectPDF and it seems to ignore CCS files that are included in the selected URL. CCS styling works if I access the page directly but not using SelectPDF - a PDF is produced but unstyled.

I have read a number of possible solutions that suggested the following options:-

 converter.Options.CssMediaType = SelectPdf.HtmlToPdfCssMediaType.Print;
 converter.Options.EmbedFonts = true;
 converter.Options.ExternalLinksEnabled = true;
 converter.Options.InternalLinksEnabled = true;
 converter.Options.JavaScriptEnabled = true;
 converter.Options.MinPageLoadTime = 3;

I have tried all of them and still no styling applied.

Any thoughts appreciated.

Cliff C
  • 143
  • 1
  • 10

1 Answers1

0

@Cliff-C use BaseUrl property of SelectPDF

https://selectpdf.com/html-to-pdf/docs/html/M_SelectPdf_HtmlToPdf_ConvertHtmlString_1.htm

HtmlToPdf converter = new HtmlToPdf();
PdfDocument doc = converter.ConvertHtmlString(html, baseUrl);
doc.Save(file);
doc.Close();

Here baseUrl can be also folder path e.g something like c:\yourpath or you can base directory domain if using in language like c# (e.g AppDomain.CurrentDomain.BaseDirectory)

vibs2006
  • 6,028
  • 3
  • 40
  • 40