Hi,
I have a multiple page PDF with embedded signature fields. I am using some
code based on http://www.rgagnon.com/javadetails/java-0647.html
http://www.rgagnon.com/javadetails/java-0647.html to split the PDF into
individual pages. I am then using the following Groovy code to find the
names of the signature fields on each page so I can sign them.
static List getSignatureFields(String inFile) {
try {
List fields = []
// It seems necessary to load the file into the PdfReader this
way to
// avoid a java.io.IOException in sun.nio.ch.FileChannelImpl on
AIX.
byte[] content = new File(inFile).readBytes()
assert content.size() == new File(inFile).size(), "Filesystem
error"
PdfReader reader = new PdfReader(content)
AcroFields form = reader.getAcroFields()
Map allFields = form.getFields()
allFields.each{k, v->
if (form.getFieldType(k) == AcroFields.FIELD_TYPE_SIGNATURE)
{
if (k == 1 || k == '') {
throw new Exception("PDF signature field name
undefined: '${k}'")
}
fields << k
}
}
return fields
} catch (Throwable t) {
log.error(t)
}
}
It appears that when I split the pages, I am losing the catalog, so finding
the names of the signature fields is failing.
I need a new approach - either a way to parse the new page to find the
signature fields without consulting the catalog, or a way to read the
catalog before splitting and copy the relevant entries into the new pages.
Could someone give me a pointer in the right direction?
Thanks!
--
View this message in context:
http://itext-general.2136553.n4.nabble.com/Finding-signature-fields-in-a-split-page-tp2262716p2262716.html
Sent from the iText - General mailing list archive at Nabble.com.
------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit. See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://www.itextpdf.com/book/
Check the site with examples before you ask questions:
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/