Hi,
I'm trying to use the RadFlowDocument in order to create a PDF document. I have successfully managed to use the examples provided in the documentation in order to import the body of my HTML into the document, however the examples for the header and footer do not make it clear how I would go about importing HTML in.
Below is the current state of my code. Unfortunately the header comes out as plain text, but the body is successfully processed. Any advise would be greatly received.
public static byte[] GeneratePDF(DocumentTemplate doc)
{
string body = "";
body = doc.DocumentBody;
HtmlFormatProvider provider = new HtmlFormatProvider();
RadFlowDocument rfd = provider.Import(body);
rfd.Sections.AddSection();
Header defaultHeader = rfd.Sections.First().Headers.Add();
Paragraph defaultHeaderParagraph = defaultHeader.Blocks.AddParagraph();
defaultHeaderParagraph.Inlines.AddRun(doc.DocumentHeader);
PdfFormatProvider provider2 = new PdfFormatProvider();
using (MemoryStream output = new MemoryStream())
{
provider2.Export(rfd, output);
return ReadToEnd(output);
}
}