On 11/20/07, Scott Dunbar <[EMAIL PROTECTED]> wrote:
>
>  I was only able to do it by "fiddling with the dom".  My requirements are
> to support PDF 1.6 and PDF 1.7 dynamic and static forms and to take XDP
> data from a submitted form and merge it into a PDF.  The way I did that was
> to handle either the "old" way with mergeXfaData() (PDF 1.6 dynamic and
> static and PDF 1.7 static) or the "new" way (PDF 1.7 dynamic) by handling
> the DOM myself.  Unfortunately you have to do it in two different ways - the
> "dom fiddling" does not seem to work with the older forms.
>

This is helpful. I'm not merging, but creating a custom pdf per-user  based
on information from a database. This requires, as far as I can tell,
updating or adding a value + text node to a field. There is more to it,
though, since I can do this, see the change in the pdf (via itext
inspection), but the form neither shows nor submits this data.

Hmm, your method may be a solution. I could build an XDP on the fly, then
merge it into the document. Where is your xpd parser from? Is that yours? I
know next to nothing about building an xml parser class.

Do you detect the version and dynamic/static nature of the form with itext?
When I use the isDynamicForm() method I'm always getting false. Ah, I see,
you look for the presence of acrofields.


XDPDOMParser is a class that handles all aspects of the parsing of the XDP.
> It would not be hard to remove this but the key for me is to take the
> xfa:datasets from a separate XDP and replace the data in an existing PDF.
> This simply requires removing the old xfa:dataset  Node and importing the
> new xfa:dataset Node into the destination document - that is what the
> copyDataSets method below does.
>
> My code looks like the below.  If you have any questions, let me know.
>
> // pdfStamper is a PdfStamper using a PdfReader from my source PDF and a
> temp output file
> // inputDataElement is the xfa:data Node from the input XDP
> // inputParser is a XDPDOMParser for my input XDP
>
>
> if( pdfStamper.getAcroFields().getFields().size() != 0 ) // then use the
> "old" way
> {
>     AcroFields fields = pdfStamper.getAcroFields();
>     fields.mergeXfaData( inputDataElement );
> }
> else // then this is a pdf 1.7 dynamic
> {
>     XfaForm xfaForm = new XfaForm( pdfStamper.getReader() );
>     XDPDOMParser xdpParser = new XDPDOMParser( xfaForm.getDomDocument() );
>
> // copy from an existing xdp xfa:dataset into the xdpParser
>     xdpParser.copyDataSets( inputParser.getDocument() );
>     xfaForm.setChanged( true );
>
>     xfaForm.setXfa( XfaForm.serializeDoc( xfaForm.getDomDocument() ),
> pdfStamper.getReader(), pdfStamper.getWriter() );
> }
>
>
> Erik Pearson wrote:
>
> Hi,
>  I'm wondering if anyone could provide pointers or working examples of
> using iText with a dynamic pdf 1.7 form produced by LiveCycle. I've
> managed to stumble into updating the pdf the point where I've inserted a
> value tag for an empty field, which I can see afterward in the new, modified
> pdf, but the changes are not visible, nor are the values submitted with the
> form.
>
>
> Rather than fiddling with the dom document, Perhaps an xml/xfa merge
> operation?
>
>  Sigh, with static pdfs it was so easy with acroforms ...
>
>  Thanks in advance,
>
>  Erik.
>
> ------------------------------
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>
> ------------------------------
>
> _______________________________________________
> iText-questions mailing list
> [EMAIL PROTECTED]://lists.sourceforge.net/lists/listinfo/itext-questions
> Buy the iText book: http://itext.ugent.be/itext-in-action/
>
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> iText-questions mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
> Buy the iText book: http://itext.ugent.be/itext-in-action/
>
>
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to