I am creating a PDF from another PDF which contains acrofields and getting
following issues:

   1.

   The acrofields behave strangely because of which the text is shifted
   down (sometimes up) to its placement in the created PDFs after the cursor
   is placed and clicked in the form field to edit the text. This behavior
   does not occur in the original PDF documents.
   2.

   Now if we make flat pdf from this by setting stamper
   .setFormFlattening(true), then text of acrofields are not written at
   exact position by small amount which result in overlapping of text if two
   acrofields are very close to each other.

The code which i am using is


import com.itextpdf.text.pdf.AcroFields;
import com.itextpdf.text.pdf.PdfReader;
import com.itextpdf.text.pdf.PdfStamper;

String pdfName =  "pdfName.pdf";
PdfStamper stamper = null;FileOutputStream fout = null;
PdfReader reader = new PdfReader(pdfName);
fout = new FileOutputStream("outputpdf.pdf");
stamper = new PdfStamper(reader, fout);
AcroFields acroFields = stamper.getAcroFields();Map fieldMap =
acroFields.getFields(); Set keys = fieldMap.keySet();
for (Iterator it = keys.iterator(); it.hasNext();) {
    String fieldName  = (String) it.next();
    acroFields.setField(fieldName,acroFields.getField(fieldName));}

stamper.setFormFlattening(false);
stamper.close();

I have tried it for the latest version of itext (itext5.4.0).

The PDF which i am using is

http://www.herosh.com/download/11083031/sample-font.pdf.html

*
*Thanks in advance and hoping will be able to get some solution for it...*


*Thanks,
Aston
------------------------------------------------------------------------------
Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester  
Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the  
endpoint security space. For insight on selecting the right partner to 
tackle endpoint security challenges, access the full report. 
http://p.sf.net/sfu/symantec-dev2dev
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to