|
-
Dec 8th, 2012, 04:04 PM
#1
Thread Starter
New Member
Help reading a PDF
Hello.
I'm new here.
I've been asked to modify code that reads an XML file to also read a PDF (the source data can come in either format).
I'm working with VB5 and Adobe Acrobat 9 Pro.
I've been searching the web for examples and clues, but I see many different approaches.
Please advise on the easiest way to read a PDF.
-
Dec 8th, 2012, 08:50 PM
#2
Re: Help reading a PDF
You could use the AcroPDF.dll
It's a PDF viewer that you can place in a form of your project
You'll find a lot of information if you google VB6 & AcroPDF
JG
... If your problem is fixed don't forget to mark your threads as resolved using the Thread Tools menu ...
-
Dec 9th, 2012, 03:26 AM
#3
Re: Help reading a PDF
What does it mean to 'read' PDF?
If you just need to 'view' the PDF file then you simply use the appropriate system function ShellExecute, indicating "open" in the parameter lpOperation:
http://allapi.mentalis.org/apilist/ShellExecute.shtml
If you distribute your applications keep in mind that:
1) no guarantees that the user's system is installed Acrobat (could have Foxit Reader or another viewer) for which the ShellExecute function is strongly recommended because it will use the viewer installed, it does not matter what it is.
2) ShellExecute is a system function present in all Windows versions, so nothing OCX / DLL to distribute and install, which they bring with them always the 'usual' version compatibility issues.
-
Dec 9th, 2012, 09:47 AM
#4
Re: Help reading a PDF
As gibra says the easiest way is to use the ShellExecute API but the user will have to have an Acrobat Reader installed as it uses the default app to open a pdf file.
The ShellExecute is a very powerful API as it can do many things, open files, print files and email.
Keith
I've been programming with VB for 25 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.
-
Dec 10th, 2012, 12:14 PM
#5
Thread Starter
New Member
Re: Help reading a PDF
 Originally Posted by gibra
What does it mean to 'read' PDF?
Specifically I need to open it, read each line, extract data from it, just like we already do from an XML file.
-
Dec 10th, 2012, 02:18 PM
#6
Re: Help reading a PDF
 Originally Posted by o1sowise
Specifically I need to open it, read each line, extract data from it, just like we already do from an XML file.
Then you should use the Acrobat and PDF Library
http://livedocs.adobe.com/acrobat_sd...nce/index.html
-
Dec 10th, 2012, 02:36 PM
#7
Thread Starter
New Member
Re: Help reading a PDF
 Originally Posted by gibra
... in VB, not C???
-
Dec 11th, 2012, 10:42 AM
#8
Re: Help reading a PDF
 Originally Posted by o1sowise
... in VB, not C???
You need to download SDK, will found a lot of sample for many languages:
http://livedocs.adobe.com/acrobat_sd...ccessible=true
-
Apr 9th, 2013, 11:29 PM
#9
New Member
Re: Help reading a PDF
Hi,
I use this code to view my PDFs from Excel:
Option Explicit
Private Declare Function ShellExecute Lib "shell32.dll" _
Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpszOp As String, _
ByVal lpszFile As String, ByVal lpszParams As String, _
ByVal LpszDir As String, ByVal FsShowCmd As Long) _
As Long
Const SW_SHOWNORMAL = 1
Sub OpeninPDFannotator()
Dim strPath, strParam As String
strPath = ThisWorkbook.Path & "\Resources\test.pdf"
strParam = Chr(34) & strPath & Chr(34) & " /page=15" & Chr(34)
Call ShellExecute(0&, "open", "C:\Program Files (x86)\PDF Annotator\pdfannotator.exe", strParam, "", SW_SHOWNORMAL)
Excel.Application.Visible = msoTrue
End Sub
"Excel.Application.Visible = msoTrue" does not work because the code does not wait until the ShellExecute has finished.
Does anyone know how to get my code to wait for the shellexecute to finish?
Thanks in advance!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|