Generate PDF form from XML
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>