0
私はちょうど私が既存のPDFファイルにパスワードを追加することができますか質問したい、私はちょうど水晶レポートを使用してPDFファイルを作成し、報告する。事前にどうもありがとうございました。vb.netを使用してPDFファイルにパスワードを追加
「c:\ Folder1 \ sample.pdf」というファイルがすでに存在するとします。単語「PdfReader」をしている私には、以下のようなコードを見てきましたが、私はそれが
' Define input and output files path.
Dim intputFilePath As String = Program.RootPath + "\\" + "1.pdf"
Dim outputFilePath As String = Program.RootPath + "\\" + "1_with_pw.pdf"
' Set passwords for user and owner.
Dim userPassword As String = "you"
Dim ownerPassword As String = "me"
' Create password setting.
Dim setting As PasswordSetting = New PasswordSetting(userPassword, ownerPassword)
' Add password to plain PDF file and output a new file.
Dim errorCode As Integer = PDFDocument.AddPassword(intputFilePath, outputFilePath, setting)
If errorCode = 0 Then
Console.WriteLine("Success")
Else
Console.WriteLine("Failed")
End If