Java Mailing List Archive

http://www.junlu.com/

Google
Google
Mailing List
Home
Forum Home
JBoss - Java Application Server
Tomcat - JSP/Servlet container
Struts - A MVC web framework
iText - An open source PDF Java Library
JDOM - JDOM XML Parser
J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition
J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog
JSP - A mailing list about Java Server Pages specification and reference
Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology
Struts & Hibernate
Subjects
JSP editor plugin for eclipse ?
org apache jasper JasperException: Unable to compile class for JSP
Tomcat: Connection reset by peer: socket write error
Cannot retrieve definition for form bean null
Struts Tiles Tutorial (free Struts training)
Where do I download Tomcat 4 0 6?
Data Access Object (DAO) pattern, example DAO 's
Where to download Tomcat v 4 1 24 from?
Tomcat 5 0 16 Requested resource not available
Oracle Connection Pooling in 3 2 2
Servlet : Session invalidate
Servlet action is currently unavailable
Tomcat/Struts Unicode Encoding/Decoding problems
Tomcat and webapplication specific java library path
Running a Simple JMS Example
Mapping in workers2 properties
org apache jasper JasperException
Cannot find message resources under key org apache struts action
   MESSAGE
problem with html:text bean throwing exception
Cannot find message resources under key org apache struts action MESSAGE
invalid direct reference problem with solution
Tool for jsp debug Try Sysdeo Eclipse Plugin
Tomcat 5 Cannot load JDBC driver class 'null ' SQL state: null
weblogic ejbc
java properties file
Jboss 3 2 3 Coyote Can 't re
Tomcat 5, Apache2 and mod jk2 integration problem
JBoss example problem new to J2EE
url string for connecting jboss to oracle
Value attribute of <html:checkbox
javax servlet ServletException: BeanUtils populate
HTTP Status 404 The requested resource is not available
5 0 18: Windows XP Pro vs Windows 2000
 
AcroForm and AcroField PLUS FAQ ENTRY

AcroForm and AcroField PLUS FAQ ENTRY

2006-09-01       - By Henry Doan

 Back
Thank you, Thank you, Thank you.  The second suggestion was exactly what i
was looking for.

For those who are reading this also, you can use
"Not the correct syntax" -- AcroField.renameField(String oldName, String
newName)
to rename the field.


>From: "Mark Storer" <MStorer@(protected)>
>Reply-To: Post all your questions about iText here
><itext-questions@(protected)>
>To: "Post all your questions about iText here"
><itext-questions@(protected)>
>Subject: Re: [iText-questions] AcroForm and AcroField  PLUS FAQ ENTRY
>Date: Thu, 31 Aug 2006 12:35:53 -0700
>
>I'm pretty sure this is in the FAQ somewhere.  Thought I don't know the FAQ
>URL off the top of my head... lets see here...  It's not there.  I'm
>shocked.
>
>But there is a form for submitting FAQs:
>
><site:faq-entry name="Why do forms behave strangely when I merge them?">
><site:question>When I merge two forms together, different copies of the
>same name have the same value.  What can I do to maintain seperate copies
>of the fields within the same form?</site:question>
><site:answer>
>All fields in a PDF file with the same name share a value.  This becomes
>obvious when two copies of a form try to coexist within a single PDF, but
>can be a relatively subtle problem with common field names ("Name",
>"Address" and so forth).
>
>This problem can be further obscured by iText when it is asked to generate
>field appearances.  The individual appearances will contain the
>corresponding value until one of them is edited.  At that time, Reader will
>update all the fields to hold the new value.  From Reader's point of view,
>they always shared a value and merely had inaccurate appearances.  
>JavaScript asked to retrieve a given field's value will return that single
>value.
>
>There are two solutions if you absolutely must merge forms:
>
>1) Flatten the individual instances of the form, save them, then stitch
>them all together.
>
>Flattened forms aren't really forms anymore, they're regular PDFs that
>happen to look like one.  They aren't editable, and there's no script,
>calculations, or formatting (which can be a problem).  You don't need
>PdfCopyForm, PdfCopy alone will work.  In fact, you can merge a single
>normal form together with any number of flattened forms.
>
>2) Rename all the fields.
>
>For all but the simplest forms, you should strive to avoid merging them
>unless you know EXACTLY what you are doing, and can plan for it.
>
>Develop some name-mangling scheme and consistently apply it to your fields
>as you import them.  Something like appending "__#" where the # is an ID
>number.  This avoids name collisions.  You'll have to bone up on the
>PdfReference and manipulate PdfDictionary objects directly.  Further, this
>must be done before attaching them to an instance of PdfCopyForm.  Once a
>PdfWriter is attached to a PdfReader, you can't be sure that any changes
>you make will "stick".
>
>There are problems with renaming fields.  Firstly, most field scripts are
>written with specific field names in mind.  Furthermore, some signatures
>key off field names, but merging them will invalidate those signatures no
>matter what you do.
>
>Assuming for a moment that you have control over the initial PDF forms
>you'll be using, you can rewrite your scripts to recognise which instance
>of a particular field is the appropriate one.  In field events, you can
>check the current field's name to see how to access other fields from the
>same form.  Parse out the mangled name, and use it to determine the name of
>the appropriate field form the same form.  Document level scripts and
>events are more challenging though it should be possible to set a global on
>each page's "Page Open" event and access the appropriate fields that way.
>
>If you do not have control over the forms and cannot rewrite their script,
>there's not much you can do programmatically.  The moment someone builds a
>field name from parts (getField("quantity_" + rowNum)), it's effectively
>impossible to fix in a general way.  Specific cases may be more tractable.
></site:answer>
></site:faq-entry>
>
>--Mark Storer
>   Senior Software Engineer
>   Cardiff Software
>
>#include <disclaimer>
>typedef std::Disclaimer<Cardiff> DisCard;
>
>
>
> > -- --Original Message-- --
> > From: itext-questions-bounces@(protected)
> > [mailto:itext-questions-bounces@(protected)]On
> > Behalf Of Henry
> > Doan
> > Sent: Thursday, August 31, 2006 9:47 AM
> > To: itext-questions@(protected)
> > Subject: [iText-questions] AcroForm and AcroField
> >
> >
> > Hi i am coping the same pdf file into one big one and each
> > time i copy them
> > in I fill out the form field uniquely, and it shows up too.
> > But when i try
> > to change the form field inside a browser on one pdf page it
> > changes on all
> > of the other pdf page too.
> >
> >
> > Heres my code:
> >
> > // FOR COPYING FORMS
> > PdfCopyFields copy = new PdfCopyFields(baos);
> > // GET THE FILE
> > PdfReader reader2 = null, reader = new PdfReader("e:/myFile.pdf");
> >
> > int tmp =0;
> > while (tmp <= 5){
> >    // WRITE TO PDF
> >    reader2 = new PdfReader("e:/Webs/walton/ICF.pdf");
> >    stamp1 = new PdfStamper(reader2, baos2);
> >    acroField = stamp1.getAcroFields();
> >    acroField.setField("Name", strName);
> >
> >    stamp1.close();
> >    reader.close();
> >
> >    //write to baos then read from it and copy it to [copy]
> >    reader2 = new PdfReader(baos2.toByteArray());
> >    copy.addDocument(reader2);
> >    tmp++;
> > }
> >
> > Thank you,
> >
> > __ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ __
> > Windows Live Spaces is here! It's easy to create your own
> > personal Web site.
> >   http://spaces.live.com/signup.aspx
> >
> >
> >
>
>-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -----
>Using Tomcat but need to do more? Need to support web services, security?
>Get stuff done quickly with pre-integrated technology to make your job
>easier
>Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
>http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
>__ ____ ____ ____ ____ ____ ____ ____ ____ ____
>iText-questions mailing list
>iText-questions@(protected)
>https://lists.sourceforge.net/lists/listinfo/itext-questions

__ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ __
Check the weather nationwide with MSN Search: Try it now!  
http://search.msn.com/results.aspx?q=weather&FORM=WLMTAG


-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -----
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
__ ____ ____ ____ ____ ____ ____ ____ ____ ____
iText-questions mailing list
iText-questions@(protected)
https://lists.sourceforge.net/lists/listinfo/itext-questions

©2008 junlu.com - Jax Systems, LLC, U.S.A.