Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. public void Sign(string SigReason, string SigContact, string SigLocation, bool visible)
  2. {
  3. PdfReader reader = new PdfReader(this.inputPDF);
  4. /*ERROR-->*/PdfEncryptor.Encrypt(reader, new FileStream(this.outputPDF, FileMode.Create, FileAccess.Write), true, null, null, PdfWriter.AllowFillIn | PdfWriter.AllowScreenReaders);
  5. PdfStamper st = PdfStamper.CreateSignature(reader, new FileStream(this.outputPDF, FileMode.Create, FileAccess.Write), '', null, true);
  6. st.MoreInfo = this.metadata.getMetaData();
  7. st.XmpMetadata = this.metadata.getStreamedMetaData();
  8. PdfSignatureAppearance sap = st.SignatureAppearance;
  9.  
  10. sap.SetCrypto(this.myCert.Akp, this.myCert.Chain, null, PdfSignatureAppearance.WINCER_SIGNED);
  11. sap.Reason = SigReason;
  12. sap.Contact = SigContact;
  13. sap.Location = SigLocation;
  14.  
  15. if (visible)
  16. sap.SetVisibleSignature(new iTextSharp.text.Rectangle(100, 100, 250, 150), 1, null);
  17.  
  18. st.Close();
  19.  
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement