Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How to programmatically convert Excel workbook to PDF with password protection in .NET

Guest
May 02, 2016 May 02, 2016

I'm able to convert an Excel workbook to PDF in code with Visual Studio. I would like to password protect the PDF file but can't find a property or method to accomplish this. Directly from Excel its possible to convert to PDF with protection but how is this possible in code?

               ' Create the Adobe component
                myPDF = GetObject("", "PdfDistiller.PdfDistiller")
             
               ' Open Excel Workbook and save as post script
               MyXL = New Excel.Application
               MyXL.Workbooks.Open(InFile, 0)
               MyXL.ActiveWorkbook.PrintOut(Copies:=1, Preview:=False, PrintToFile:=True, Collate:=True, PrToFileName:=PSFileName)
               MyXL.Workbooks.Close()

                ' Convert the PS file to PDF
                 myPDF.FileToPDF(PSFileName, PDFFileName, "")

Thank you for any feedback to accomplish this.

TOPICS
Acrobat SDK and JavaScript , Windows
702
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 03, 2016 May 03, 2016
LATEST

You can specify security in Acrobat Distiller.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines