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 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.
- 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
- When you need call this software from Visual Basic, please refer to the following code templates:
-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
Private Sub Command1_Click()
Dim nRet As Long
Dim strCmd As String
strCmd = "pdfprint -$ XXXXXXXXXXXXXXXXXXXX"
strCmd = strCmd & " -ispasswordprotected"
strCmd = strCmd & " """ & App.Path & "\readme.pdf"""
nRet = VeryPDF_PDFPrint(strCmd)
During the using, if you have any question, please contact us as soon as possible.