- 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
Generate PDF form from XML
The following code sample shows how to generate a PDF form from XML:
C#
using (FileStream stream = new FileStream("form.xml", FileMode.Open, FileAccess.Read))
using (FileStream file = new FileStream("form.pdf", FileMode.Create, FileAccess.Write))
{
Document document = new Document();
document.Write(new XmlTextReader(stream), file);
}
XML
<document>
<section>
<paragraph type="drawing" width="200" height="200">
<shape width="200" height="30" x="0" y="160" type="TextFieldShape" fullname="text1" fontsize="12" value="test value" />
<shape width="200" height="30" x="0" y="120" type="PushButtonFieldShape" fullname="button1" fontsize="12" caption="Push me" />
<shape width="30" height="30" x="0" y="80" type="CheckBoxFieldShape" fullname="check1" fontsize="12" value="true" />
</paragraph>
</section>
</document>