using iTextSharp.text.pdf; using (Stream input = new FileStream(InputFile, FileMode.Open, FileAccess.Read, FileShare.Read)) { using (Stream output = new FileStream(OutputFile, FileMode.Create, FileAccess.Write, FileShare.None)) { PdfReader reader = new PdfReader(input); PdfEncryptor.Encrypt(reader, output, true, userpwd, masterpwd,PdfWriter.AllowScreenReaders); } }
System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding(); writer.SetEncryption(null, encoding.GetBytes("12345678"), PdfWriter.ALLOW_COPY | PdfWriter.ALLOW_PRINTING, PdfWriter.STRENGTH40BITS);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)