Get The Page Count of a PDF File
Category:Files and Directories
Version Compatibility: Visual Basic 6, Visual Basic 5
This sub procedure lets you get the page count for a given PDF file. The page count usually appears somewhere in the last 50 lines of the file. Simply open the file in binary mode and parse through the content searching for “/count”. To test this, simply add a command button and label control to your Winform. Be sure to update the path to your PDF file in the command button control’s event handler.
Instructions: Copy the declarations and code below and paste directly into your VB project.