
(openPsd, permissionPsd, .Default, .Key128Bit) 'Set open password and permission password for PDF
Save the Word document to PDF with password using Doucment.SaveToFile(string fileName, ToPdfParameterList paramList) method.ĭim parameters As ToPdfParameterList = New ToPdfParameterList. Specify the open password and permission password and then set both passwords for the generated PDF using () method.
Create a ToPdfParameterList object, which is used to set conversion options.
Load a sample Word document using Document.LoadFromFile() method. The ToPdfParameterList parameter controls how a Word document will be converted to PDF, for example, whether to encrypt the document while conversion. To convert Word to a Password-Protected PDF, you can use the Document.SaveToFile(string fileName, ToPdfParameterList paramList) method.
Private Shared Sub Main(ByVal args() As String)ĭocument.LoadFromFile("C:\Users\Administrator\Desktop\Test.docx")ĭocument.SaveToFile("ToPDF.pdf", FileFormat.PDF)Ĭonvert Word to Password-Protected PDF in C# and VB.NET