linq - itext XFA: InvalidCastException -
using itext7 , when trying load xfa form i'm getting:
system.invalidcastexception: 'unable cast object of type 'system.xml.linq.xtext' type 'system.xml.linq.xelement'.'
source code:
var pdfreader = new pdfreader(package.pdftemplate); pdfreader.setunethicalreading(true); using (var document = new pdfdocument(pdfreader, new pdfwriter(writems))) { var acroform = pdfacroform.getacroform(document, true); var xfa = acroform.getxfaform(); var dataxml = _datagenerator.generatexfaformdata(package); xfa.fillxfaform(dataxml); xfa.write(document); }
the exception thrown on line
var acroform = pdfacroform.getacroform(document, true);
sample pdf can seen here: https://programmcze-my.sharepoint.com/personal/nechanicky_programmcze_onmicrosoft_com/_layouts/15/guestaccess.aspx?docid=0c18710068a124a58a32e77ad53c4cbb9&authkey=aqvvbzlxnirrisljvt083xy
there indeed problem constructing xfaform
not contain <xfa:datasets>
entry.
the problem fixed in itext 7.0.5-snapshot
version. repository sources , fix can found here.
Comments
Post a Comment