How to check PDF file is password protected by Visual Basic?

Question:How to check PDF file is password protected or not in Visual Basic then we can print the PDF files in batch easily. I know of several tools/libraries that can do this but I want to know if this is possible with just program in Visual Basic. Thanks in advance, I hope I can find a solution on VeryPDF?

Answer: According to your needs, maybe you can have a free trial of software VeryPDF PDFPrint SDK, By this software, you can check PDF file is password protected or not in Visual Basic then print PDF directly to paper document. This software is a professional tool of printing PDF file.  But this software only can check whether PDF is protected by open password, as this software can print owner password PDF file to paper document directly. Please check related information of this software on homepage, in the following part, let us check how to use this software.

Step 2. Free download PDFPrint SDK

  • There are two license types: server version and developer version, please choose the proper version according to your needs.
  • When downloading finishes, there will be a zip file. Please extract it to some folder then you can check help documents and related documents.

Step 2. Check PDF file is password protected or not in Visual Basic  and then print PDF.

  • When you use this software, please refer to the usage and help documents.
  • When check PDF file is password protected and print PDF, you may need the following parameters:
    -ispasswordprotected         : check if a PDF file protected by 'open password' or not
  • -getpagecount                : read page count from input PDF file
      -jobusername <string>        : specify the name of the user who owns the print job
      -jobdocname <string>         : specify document name of print job
      -ownerservicename <string>   : specify the name of OwnerService on Windows Server 2008
      -useownerservice             : force to use owner service for all systems
      -deleteownerservice <string> : remove the OwnerService from Windows
      -silent                      : print PDF files silently
      -timeout <int>               : specify a timeout to avoid hanging pdfprint process, in millisecond

  • When you need call this software from Visual Basic, please refer to the following code templates:
  • Private Sub Command1_Click()
    Dim nRet As Long
    Dim strCmd As String
       strCmd = "pdfprint -$ XXXXXXXXXXXXXXXXXXXX"
        strCmd = strCmd & " -ispasswordprotected"
       strCmd = strCmd & " """ & App.Path & "\readme.pdf"""
    MsgBox (strCmd)
    nRet = VeryPDF_PDFPrint(strCmd)
    MsgBox (Str(nRet)
    End Sub

During the using, if you have any question, please contact us as soon as possible.

VN:F [1.9.20_1166]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.20_1166]
Rating: 0 (from 0 votes)

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

Verify Code   If you cannot see the CheckCode image,please refresh the page again!