I'm using iTextSharp to convert HTML to a PDF and email it. It's working fine, except it doesn't seem to support the "background" style. This is the code I'm using to parse the HTML
private MemoryStream createPDF(string html){
MemoryStream msOutput = new MemoryStream();
TextReader reader = new StringReader(html);
Document document = new Document(PageSize.A4, 30, 30, 30, 30);
PdfWriter writer = PdfWriter.GetInstance(document, msOutput);
HTMLWorker worker = new HTMLWorker(document);
document.Open();
writer.CloseStream = false;
worker.StartDocument();
worker.Parse(reader);
worker.EndDocument();
worker.Close();
document.Close();
msOutput.Position = 0;
return msOutput;
}
And the HTML looks something like this:
<p>
Have you <span style="background:red;padding:0.1em 0;" title="This has been brought to your attention.">ever switched your electronic medical records vendor? If so...</span></p>
Which doesn't highlight the text, which I would like it to. However, using "color:red", works, changing the color of the text, but I need it to highlight, like 'background' would do.
Anyway, I've been searching for the last day and can't find a solution. Is this possible? If not, is there a library that supports this? I've also tried the Pechkin library, but the same thing happens.