0
我真的很感謝你的建議。我使用的是MVC3,我希望用戶通過打開一個受密碼保護的對話框保存到自己的路徑。你們能幫我解決這個問題嗎?如何打開保存對話框保存pdf
下面是我的代碼:
mydoc.GenerateLetter(PdfData);
string WorkingFolder = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
using (MemoryStream m = new MemoryStream())
{
m.Write(mydoc.DocumentBytes, 0, mydoc.DocumentBytes.Length);
m.Seek(0, SeekOrigin.Begin);
string OutputFile = Path.Combine(WorkingFolder, PdfData.Name + ".pdf");
using (Stream output = new FileStream(OutputFile, FileMode.Create, FileAccess.Write, FileShare.None))
{
PdfReader reader = new PdfReader(m);
PdfEncryptor.Encrypt(reader, output, true, "abc123", "secret", PdfWriter.ALLOW_SCREENREADERS);
}
}