First, I was directed here when I asked this same question on StackOverflow. For reference, that's here:
https://stackoverflow.com/questions/496 ... yle-sheets
I'm using CefSharp (v63) to convert HTML-based reports (stored on the local file system) to PDF for portability via the PrintToPdfAsync method.
Generally, this works exactly as intended and produces a faithful copy of the rendered HTML in PDF format. However, if the original HTML document contains a reference to an external style sheet (also stored on the local file system), those styles are not reflected in the resulting PDF file.
Note, the rendered HTML is using the external style sheets as intended. That is, in the CefSharp browser, the results are rendered as expected. However, once exported, externally referenced styles do not get baked int the resulting PDF.
Specifically, I notice issues with basic table formatting in the PDF (incorrect margins, paddings, borders, ...).
If I instead put the externally referenced style content directly in the HTML document, the style info is correctly reflected in the final PDF.
I have experimented with the WPF and the OffScreen assemblies. Both seem to exhibit the same behavior.
Any input appreciated.