Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!
![]() |
Extract Metadata |
Post Reply ![]() |
Author | |
Guna ![]() Beginner ![]() Joined: 06 Mar 14 Location: India Status: Offline Points: 2 |
![]() ![]() ![]() ![]() ![]() Posted: 06 Mar 14 at 5:12PM |
Hi,
I want to know how to create a specific action to extract metadata from the PDF. This action must be automated so that I can extract 100 document titles. Please help!! Regards, Guna
|
|
![]() |
|
AndyD ![]() Senior Member ![]() ![]() Joined: 30 Apr 13 Location: UK Status: Offline Points: 54 |
![]() ![]() ![]() ![]() ![]() |
This solution is For VB6. 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.
Edited by AndyD - 08 Mar 14 at 9:19AM |
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store