- How to add page numbers to your PDF
- Add text field to PDF
- Append multiple PDF documents
- Bulleted list from XML and XSL
- Merge PDF
- Calculate the height of a paragraph in PDF
- Multipage TIFF to PDF
- Convert TXT to PDF
- Convert XHTML to PDF
- Create PDF in C# - Tall Components - Check out our PDF code samples
- Text formatting
- Generate PDF form from XML
- Generate PDF with local images from XML with Xamarin.iOS
- XhtmlParagraph and TrueType fonts
- Add footer with left and right aligned text on same line
- Read and write meta data from PDF
- Stitch PDF documents
- Use multiple licenses
- What is the resulting fontsize in PDF rich text used in SimpleXhtmlShape
Convert XHTML to PDF
This code sample shows how to add a note to a PDF document.
C#
Document document = new Document();
Section section = document.Sections.Add();
XhtmlParagraph xhtmlParagraph = new XhtmlParagraph();
ConversionSettings conversionSettings = new ConversionSettings();
conversionSettings.FontPath = @"..\fonts";
xhtmlParagraph.Settings = conversionSettings;
xhtmlParagraph.Text = "<b><font color=\"brown\">Hello world!</font></b><br/>With this you can:<ul><li>Include xHTML compliant layout</li><li>Allow formatting content by (web)designers<br/>... and include it in your document</li></ul>";
section.Paragraphs.Add(xhtmlParagraph);
using (var file = new FileStream(@"..\..\result.pdf", FileMode.Create, FileAccess.Write))
{
document.Write(file);
}