Emanuele Paterna, Emanuele Paterna wrote > I've notice a strange behaviour signing an existing invisible signature > field. I've noticed that the field was created multiple times every time i > try to sign it. > I think is due to preClose method that is based on a wrong condition that > recreate the field if the field passed is invisible >> if (fieldExists) { //<--- This create the problem > Why not use this below? >> if (!isNewField()) { //condition changed to evicting create a new >> signature field
That would break another use case, namely the creation of a new invisible signature (not created using a setVisibleSignature call with collapsed rectangle parameter but using the default behavior). Unfortunately the code contains some assumptions not reflected in the names of the methods: isNewField() is true if and only if the field name was set using the setVisibleSignature(pageRect, page, fieldName) method. Especially it is NOT true if a new invisible signature field is to be created using the unique field name assigned in the constructor. To properly process those invisible signatures with automatically generated field names, therefore, the code in preClose assumes that all invisible signatures are added in new fields. Normally this assumption is not as bad as it sounds because normally predefined, empty signature fields are added to a document to show the user where to sign, and consequently are visible. Therefore, hardly anyone ever stumbles here... ;) That being said, some clean-up would be appropriate to also allow for invisible predefined empty signature fields. Your proposal merely has to be extended (constructor already setting newField to true, setVisibleSignature(fieldName) explicitly setting it to false) to work in all relevant use cases. Regards, Michael -- View this message in context: http://itext-general.2136553.n4.nabble.com/Possible-bug-on-PdfSignatureAppearance-preClose-tp4659307p4659319.html Sent from the iText - General mailing list archive at Nabble.com. ------------------------------------------------------------------------------ October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register > http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk _______________________________________________ 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