itextsharp - while creating pdf from existing pdf the acrofields position are shifting compared to original pdf -
itextsharp - while creating pdf from existing pdf the acrofields position are shifting compared to original pdf -
i creating pdf pdf contains acrofields , getting next issues:
the acrofields behave strangely because of text shifted downwards (sometimes up) placement in created pdfs after cursor placed , clicked in form field edit text. behavior not occur in original pdf documents.
now if create flat pdf setting stamper .setformflattening(true)
, text of acrofields not written @ exact position little amount result in overlapping of text if 2 acrofields close each other.
the code using is
import com.lowagie.text.pdf.acrofields; import com.lowagie.text.pdf.pdfreader; import com.lowagie.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(); (iterator = keys.iterator(); it.hasnext();) { string fieldname = (string) it.next(); acrofields.setfield(fieldname,acrofields.getfield(fieldname)); } stamper.setformflattening(false); stamper.close();
i have tried same code latest version of itext (itext5) gives same result.
the pdf using
http://www.herosh.com/download/11083031/sample-font.pdf.html
pdf itextsharp itext
Comments
Post a Comment