I was also working on the same functionality but was only able to "ENABLE" print and securing PDF file with password.
Here is the code, it is saving the file in desktop. you can change the path as your requirement.
using iTextSharp;
using iTextSharp.text;
using iTextSharp.text.pdf;
protected void Page_Load(object sender, EventArgs e)
{
string WorkingFolder = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
string InputFile = Path.Combine(WorkingFolder, "StickerSheet_New.pdf");
string OutputFile = Path.Combine(WorkingFolder, "2.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);
System.Text.UTF8Encoding Encoding = new System.Text.UTF8Encoding();
PdfStamper stamper = new PdfStamper(reader, output);
stamper.SetEncryption(Encoding.GetBytes("23!54"), null, PdfWriter.AllowScreenReaders, PdfWriter.STRENGTH40BITS );
stamper.Close();
reader.Close();
Response.Write("PDF created");
}
}
}
}
}
Still searching for
enable saveas button in pdf file.