EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Encrypt iTextSharp pdf before export

Posted: 03/30/2016 23:09:37
by Ravikant Sharma (Basic support level)
Joined: 03/29/2016
Posts: 16

Dear Team,

Below is my code sample which exporting pdf through iTextSharp dll.I want to encrypt the pdf and then export.

could you please let me know how should i put below line to get this done or modify accordingly:

---------------------------Encrypt PDF---------------------------------
FileStream outF = new FileStream(fname, FileMode.Create);
result = Encrypt(f.InputStream, outF);

--------------------Export PDF------------------------------------------
Document pdfDoc = new Document(PageSize.A4.Rotate(), 13f, 13f, 13f, 13f);
//PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
PdfWriter writer = PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
writer.ViewerPreferences = PdfWriter.PageModeUseOutlines;
PdfFooter eventHandler = new PdfFooter();
writer.PageEvent = eventHandler;
PdfPTable table = GetPdfTable(dtdetails);
Response.ContentType = "application/pdf";
Response.AddHeader("content-disposition", "attachment;filename=" + filename);

Appreciate you quick response.

Posted: 03/31/2016 02:09:26
by Eugene Mayevski (Team)

I am sorry but we don't provide support for iText.

With SecureBlackbox you need to open the PDF document (this can be a stream), encrypt it and then save the document.

Sincerely yours
Eugene Mayevski



Topic viewed 1598 times

Number of guests: 1, registered members: 0, in total hidden: 0


Back to top

As of July 15, 2016 EldoS business operates as a division of /n software, inc. For more information, please read the announcement.

Got it!