Hi,
This is a question regarding XFA document to static pdf document.
I have XFA document structured like this. It is designed to insert data and base encoded pdf.
<xdp:xdp xmlns:xdp=‘http://ns.adobe.com/xdp/’> <xfa:datasets xmlns:xfa=‘http://www.xfa.org/schema/xfa-data/1.0/’> xfa:data
My Data
</xfa:data> </xfa:datasets> <pdf xmlns=“http://ns.adobe.com/xdp/pdf/”>
Base64 encoded PDF.
</xdp:xdp>
How can use this to convert it to a static pdf document.
I tried the following approach. Please correct me if this approach is not correct .
Convert the above string to a stream and used Form().FlattenAllFields();
Constructor error : Invalid pdf format:pdf head signature is not found!: v4.3.0.0
Form form = new Form(inputstream,outputstream);
string formData = GetFormData();//custom method that returns the above string
byte[] byteArray = Encoding.ASCII.GetBytes(
formData );
var inputStream = new MemoryStream(byteArray);
MemoryStream outputStream = new MemoryStream();
var forms = new Form(inputstream, outputStream);
forms.FlattenAllFields();
forms.Save();