This solution is For VB6. One example of this would be if you wanted to read the Title data from a list of PDF's and display them in a Listbox. I use this personally in a program because many PDF filenames are quite random whereas you can store meaningful info in the title and use that instead. First I have a form with a basic listbox on it. Then at runtime just set the column headers. Private Sub Form_Load() Set colX = ListView1.ColumnHeaders.add() colX.Text = "Filename" colX.Width = 1 ' I set this to 1 to hide this column as the Filename isn't useful to me visually but is used elsewhere. Set colX = ListView1.ColumnHeaders.add() colX.Text = "Document Description" colX.Width = 9100 End Sub Then either within the form load or from a button call, the following routine will loop through all the PDF's in a specific folder, using the Call ReadPDF function it extracts the Title information from each PDF and displays it in the listbox. Dim sFile As String Dim FullPath as String sFile = Dir$("PDFLocation\*.*") Do Until sFile = "" If Left$(sFile, 1) <> "." Then FullPath = "PDFLocation\" & sFile Call ReadPDF(FullPath) Set ItmX = ListView1.ListItems.add(, , sFile) ItmX.SubItems(1) = msTitle End If sFile = Dir$ Loop ListView1.Sorted = True ListView1.SortOrder = lvwAscending ' This just sorts the titles alphabetically ListView1.SortKey = 1 Function ReadPDF(ByVal sFile As String) As Boolean ClassName = "DebenuPDFLibraryAX0914.PDFLibrary" LicenseKey = "Your Licence info here" Set QP = CreateObject(ClassName) Result = QP.UnlockKey(LicenseKey) If result = 1 then Call QP.LoadFromFile(sFile, "") msTitle = QP.GetInformation(2) Set QP = Nothing End If End Function Using the .GetInformation() function you can retrieve the following info: (0) = PDF Version (1) = Author (2) = Title (3) = Subject (4) = Keywords (5) = Creator (6) = Producer (7) = Creation Date (8) = Modification Date Hopefully this will help someway to achieving what you need.
|