Hi Paulo, I tried what I understood but I could not achieve my goal. Below is chunk of my code that I am doing and I am getting exception. Can you please do me a favour to send me a sample code?
I AM GETTING EXCEPTION AS: at line (obj_pdfStamper.addAnnotation(signature, a_iPageNum);) //============================= java.lang.NullPointerException at com.lowagie.text.pdf.PdfStamperImp.addAnnotation (PdfStamperImp.java:897) at com.lowagie.text.pdf.PdfStamperImp.addAnnotation (PdfStamperImp.java:948) at com.lowagie.text.pdf.PdfStamper.addAnnotation(PdfStamper.java:375) //============================= //---------------------------------------------------- FileOutputStream obj_fos = new FileOutputStream (m_objPDFSig.m_objInputPDFDocument.getAbsolutePath()+"-.pdf"); PdfStamper obj_pdfStamper = new PdfStamper(m_objPDFSig.getPDFReader(), obj_fos); PdfWriter obj_pdfWriter = obj_pdfStamper.getWriter(); PdfFormField signature = PdfFormField.createSignature(obj_pdfWriter); obj_pdfStamper.addAnnotation(signature, a_iPageNum); signature.setWidget(new com.lowagie.text.Rectangle(a_iLLX, a_iLLY, a_iURX, a_iURY), PdfAnnotation.HIGHLIGHT_INVERT); signature.setFieldName(a_strName); signature.setFlags(PdfAnnotation.FLAGS_PRINT); signature.setPage(); signature.setMKBorderColor(java.awt.Color.black); signature.setMKBackgroundColor(java.awt.Color.white); PdfContentByte cb = obj_pdfWriter.getDirectContent(); PdfAppearance tp = cb.createAppearance(a_iURX - a_iLLX, a_iURY - a_iLLY); tp.setGrayFill(1.0f); tp.rectangle(0, 0, a_iURX - a_iLLX, a_iURY - a_iLLY); tp.fill(); tp.setGrayStroke(0); tp.setLineWidth(1); tp.rectangle(0.5f, 0.5f, a_iURX - a_iLLX - 0.5f, a_iURY - a_iLLY - 0.5f); tp.closePathStroke(); tp.saveState(); tp.rectangle(1, 1, a_iURX - a_iLLX - 2, a_iURY - a_iLLY - 2); tp.clip(); tp.newPath(); tp.restoreState(); signature.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, tp); obj_pdfStamper.addAnnotation(signature, a_iPageNum); obj_pdfWriter.addAnnotation(signature); obj_pdfStamper.close(); //---------------------------------------------------- --------- Paulo Soares Message --------- That exception says it all. Go to PdfAcroForm.addSignature() source and copy what's in it. The result will be a PdfAnnotation that you can add to the doc with obj_pdfStamper.addAnnotation(annot). ------------------------------------------------------- This SF.Net email is sponsored by Yahoo. Introducing Yahoo! Search Developer Network - Create apps using Yahoo! Search APIs Find out how you can build Yahoo! directly into your own Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005 _______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions