pdf generation - pdf Form Fields password protect asp.net -


i'm using tutorial http://www.4guysfromrolla.com/articles/030211-1.aspx that’s uses pdf form fields, lets user input fields using textbox's. encrypt pdf , add user password when download need password open pdf.

   public static byte[] generatepdf(string pdfpath, dictionary<string, string> formfieldmap) {     var output = new memorystream();     var reader = new pdfreader(pdfpath);      var stamper = new pdfstamper(reader, output);      var formfields = stamper.acrofields;      foreach (var fieldname in formfieldmap.keys)         formfields.setfield(fieldname, formfieldmap[fieldname]);      stamper.formflattening = true;     stamper.close();     reader.close();      byte[] content = output.toarray(); //    byte[] content = content;      // write out pdf memory stream.      return output.toarray();  } 

to me try change logistics of how application it's going behave, instead of sending password every time user should download pdf try put in place proper authentication , authorization system.

just @ case:

  • the user list of pdf files
  • when user click on download button redirected login page
  • they enter credentials redirected file list
  • they click on pdf , download it
  • if don't have permissions download link appear disable
  • the admin can add permissions download files different users

    hope helps


Comments

Popular posts from this blog

c++ - CryptStringToBinary API behavior -

c++ - Correct method for redrawing a layered window -

java.util.scanner - How to read and add only numbers to array from a text file -