We are using spire.doc to create a PDF from HTML. So far it is working good but it appears that footnotes are not supported when Spire.Doc is used to generate a PDF. The code below works fine when FileFormat is set to "Spire.Doc.FileFormat.docx" but footnotes are not created when FileFormat is changed to "Spire.Doc.FileFormat.PDF".
Code Snippet
- Code: Select all
Document doc = new Document();
Section section = doc.AddSection();
section.BreakCode = SectionBreakType.NewPage;
Paragraph paragraph = section.AddParagraph();
paragraph.AppendHTML(<out HMTL content>);
//Add Footnote to first section
Section sectionforFootnote = doc.Sections[0];
Paragraph para = sectionforFootnote.Paragraphs[0];
Footnote footnote = para.AppendFootnote(FootnoteType.Footnote);
TextRange text = footnote.TextBody.AddParagraph().AppendText("Check Wiki to get more information");
text.CharacterFormat.FontName = "Arial Black";
text.CharacterFormat.FontSize = 8;
text.CharacterFormat.TextColor = Color.SlateGray;
footnote.MarkerCharacterFormat.FontName = "Calibri";
footnote.MarkerCharacterFormat.FontSize = 15;
footnote.MarkerCharacterFormat.Bold = true;
footnote.MarkerCharacterFormat.TextColor = Color.DarkCyan;
MemoryStream stream = new MemoryStream();
doc.SaveToStream(stream, Spire.Doc.FileFormat.PDF);
return stream.ToArray();