Beispiel #1
0
        public void CreateForm()
        {
            PdfDocument pdfDoc = new PdfDocument(new PdfWriter(FORM));
            Document    doc    = new Document(pdfDoc);

            Table table = new Table(1).UseAllAvailableWidth();

            table.AddCell("Written by Alice");
            table.AddCell(CreateSignatureFieldCell("sig1", null));
            table.AddCell("For approval by Bob");
            table.AddCell(CreateTextFieldCell("approved_bob"));

            PdfSigFieldLock Lock = new PdfSigFieldLock().SetFieldLock(PdfSigFieldLock.LockAction.INCLUDE,
                                                                      "sig1", "approved_bob", "sig2");

            table.AddCell(CreateSignatureFieldCell("sig2", Lock));
            table.AddCell("For approval by Carol");
            table.AddCell(CreateTextFieldCell("approved_carol"));

            Lock = new PdfSigFieldLock().SetFieldLock(PdfSigFieldLock.LockAction.EXCLUDE,
                                                      "approved_dave", "sig4");
            table.AddCell(CreateSignatureFieldCell("sig3", Lock));
            table.AddCell("For approval by Dave");
            table.AddCell(CreateTextFieldCell("approved_dave"));

            Lock = new PdfSigFieldLock().SetDocumentPermissions(PdfSigFieldLock.LockPermissions.NO_CHANGES_ALLOWED);
            table.AddCell(CreateSignatureFieldCell("sig4", Lock));
            doc.Add(table);

            doc.Close();
        }
Beispiel #2
0
        protected static Cell CreateSignatureFieldCell(String name, PdfSigFieldLock Lock)
        {
            Cell cell = new Cell();

            cell.SetHeight(50);
            cell.SetNextRenderer(new SignatureFieldCellRenderer(cell, name, Lock));
            return(cell);
        }
Beispiel #3
0
 public SignatureFieldCellRenderer(Cell modelElement, String name, PdfSigFieldLock Lock)
     : base(modelElement)
 {
     this.name = name;
     this.Lock = Lock;
 }