open pdf file using vb code (1 Viewer)

Imran

New member
Local time
Today, 06:00
Joined
Oct 19, 2009
Messages
1
Hi all

How to open pdf file stores in text box using vb 6

with Regards
 

DCrake

Remembered
Local time
Today, 13:00
Joined
Jun 8, 2005
Messages
8,632
When you Open do you mean view?
What do you mean by Stores in text box?

There is functionality to open adobe and view a particular pdf file. Is this what you mean?

David
 

mcdhappy80

Registered User.
Local time
Today, 14:00
Joined
Jun 22, 2009
Messages
347
When you Open do you mean view?
What do you mean by Stores in text box?

There is functionality to open adobe and view a particular pdf file. Is this what you mean?

David
Is it possible to import data from the pdf documents as it could be imported from CSV or MS Word files (external sources)?
Thanks
 

Pernia

New member
Local time
Today, 06:00
Joined
Nov 19, 2009
Messages
5
hi imran
i found a dll : ASPDF.dll in adobe reader v7.
i used it to preview any pdf file in vb6.
and it was free
 

MoxieCraz

Registered User.
Local time
Today, 09:00
Joined
Jun 8, 2010
Messages
29
hi imran
i found a dll : ASPDF.dll in adobe reader v7.
i used it to preview any pdf file in vb6.
and it was free
Do you have any further information on how to view a pdf within Access? How do I go about utilizing ASPDF.dll in adobe reader v7?
Greatly apprecitated!
 

Pernia

New member
Local time
Today, 06:00
Joined
Nov 19, 2009
Messages
5
i think probably it has a method in vba .....because it is must done in adding components including Dll(s) and ocx(s) in access forms..
had u any search for that before this?
i think we must find a code sample easily.
i help u in searching if u get no answers from Google.
 

MoxieCraz

Registered User.
Local time
Today, 09:00
Joined
Jun 8, 2010
Messages
29
Yes, I have done a lot of online searching with no success. I have even talked with someone from Microsoft that told me that there was nothing that he was aware of that would do it. I would think that there would be something. It just doesn't seem to be that far out there of a desire.

Any help would be appreciated.
 

HiTechCoach

Well-known member
Local time
Today, 08:00
Joined
Mar 6, 2006
Messages
4,357
Do you have any further information on how to view a pdf within Access? How do I go about utilizing ASPDF.dll in adobe reader v7?
Greatly apprecitated!

A simple way to view a PDF on a Access form is to use the (IE) Web Browser Control. With Access 2010, a new web browser control is now included as a built-in control in the "Tool Box".
 

salhford

Banned
Local time
Today, 06:00
Joined
Jul 5, 2010
Messages
3
You should try the following code :

Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

Private Sub Command_Click()
strDir = "<your files Directory>"
strFile = "<your filename>.pdf"
ShellExecute 0, "OPEN", strDir & strFile, "", strDir, 1
End Sub
 

nikjerry

New member
Local time
Today, 06:00
Joined
Aug 28, 2010
Messages
4
Well I am using the following code so I also suggest you to use that only once hopefully you can solve your problem and can also get the some of the idea regarding to it.

Private Sub Command1_Click
' Create a simple PDF file using the mjwPDF class
Dim objPDF As New mjwPDF
' Set the PDF title and filename
objPDF.PDFTitle = "Test PDF Document"
objPDF.PDFFileName = App.Path & "\test.pdf"
' We must tell the class where the PDF fonts are located
objPDF.PDFLoadAfm = App.Path & "\Fonts"
' View the PDF file after we create it
objPDF.PDFView = True
' Begin our PDF document
objPDF.PDFBeginDoc
' Set the font name, size, and style
objPDF.PDFSetFont FONT_ARIAL, 15, FONT_BOLD
' Set the text color


objPDF.PDFSetTextColor = vbBlue
' Set the text we want to print
objPDF.PDFTextOut _
"Hello, World! From mjwPDF (www.vb6.us)"
' End our PDF document (this will save it to the filename)
objPDF.PDFEndDoc
End Sub
 

HiTechCoach

Well-known member
Local time
Today, 08:00
Joined
Mar 6, 2006
Messages
4,357
Well I am using the following code so I also suggest you to use that only once hopefully you can solve your problem and can also get the some of the idea regarding to it.

Private Sub Command1_Click
' Create a simple PDF file using the mjwPDF class
Dim objPDF As New mjwPDF
' Set the PDF title and filename
objPDF.PDFTitle = "Test PDF Document"
objPDF.PDFFileName = App.Path & "\test.pdf"
' We must tell the class where the PDF fonts are located
objPDF.PDFLoadAfm = App.Path & "\Fonts"
' View the PDF file after we create it
objPDF.PDFView = True
' Begin our PDF document
objPDF.PDFBeginDoc
' Set the font name, size, and style
objPDF.PDFSetFont FONT_ARIAL, 15, FONT_BOLD
' Set the text color


objPDF.PDFSetTextColor = vbBlue
' Set the text we want to print
objPDF.PDFTextOut _
"Hello, World! From mjwPDF (www.vb6.us)"
' End our PDF document (this will save it to the filename)
objPDF.PDFEndDoc
End Sub

I would like to try your method. Unfortunately you did not post the code for the mjwPDF class.

Would you please post a working sample database with all the required code.
 

Mike375

Registered User.
Local time
Tomorrow, 00:00
Joined
Aug 28, 2008
Messages
2,548
I would like to try your method. Unfortunately you did not post the code for the mjwPDF class.

Would you please post a working sample database with all the required code.

Ditto...........
 

Mike375

Registered User.
Local time
Tomorrow, 00:00
Joined
Aug 28, 2008
Messages
2,548
Hi all

How to open pdf file stores in text box using vb 6

with Regards

If you mean the file/folder, that is path, is in the text box then you can open PDF with hyperlink and it will use the stored file name.
 

Beatty965

New member
Local time
Today, 06:00
Joined
Feb 21, 2011
Messages
3
A file path is not written:

C://Documents and Settings/myDoc.pdf

Instead, it should be written:

C:\Documents and Settings\myDoc.pdf
_________________

What file types can the System.IO.File object open?
Are you quite sure that it can open a .pdf file?
_________________

The quick and easy way to open a .pdf file is to use the web browser control . This assumes that both IE and the Acrobat Reader are installed on the target system. Just use the Navigate method of the control with the PDF filename as the parameter and you're there.

Note that you may have to add the web browser control to your project, by accessing the COM Components tab on the toolbox. (SEE below.)
____________-

Here is another way to read pdfs.

Right click on any of the tabs in your toolbox, and click choose items. (Just make sure you have a version of Adobe Reader installed before starting.) When the dialog box pops up click the 'Com Components' tab. Next, pick the 'Adobe PDF Reader' COM component. Click OK, and you should now see an 'Adobe PDF Reader' control in your toolbox. Click this, and drag it to your VB form.(you may need to resize it, usually appears very small).

Now in order to read any pdf, you need only alter the 'src' property of the control—either in code or in the designer. When you run the program you should be able to view the pdf doc in the VB form. You should have access to most of the options you get in Adobe Reader.

Here is how you would alter the 'src' property in code:

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
AdobeReader.src = "C:\mydoc.pdf"
End Sub
 

Beatty965

New member
Local time
Today, 06:00
Joined
Feb 21, 2011
Messages
3
A file path is not written:

C://Documents and Settings/myDoc.pdf

Instead, it should be written:

C:\Documents and Settings\myDoc.pdf
_________________

What file types can the System.IO.File object open?
Are you quite sure that it can open a .pdf file?
_________________

The quick and easy way to open a .pdf file is to use the web browser control . This assumes that both IE and the Acrobat Reader are installed on the target system. Just use the Navigate method of the control with the PDF filename as the parameter and you're there.

Note that you may have to add the web browser control to your project, by accessing the COM Components tab on the toolbox. (SEE below.)
____________-

Here is another way to read pdfs.

Right click on any of the tabs in your toolbox, and click choose items. (Just make sure you have a version of Adobe Reader installed before starting.) When the dialog box pops up click the 'Com Components' tab. Next, pick the 'Adobe PDF Reader' COM component. Click OK, and you should now see an 'Adobe PDF Reader' control in your toolbox. Click this, and drag it to your VB form.(you may need to resize it, usually appears very small).

Now in order to read any pdf, you need only alter the 'src' property of the control—either in code or in the designer. When you run the program you should be able to view the pdf doc in the VB form. You should have access to most of the options you get in Adobe Reader.

Here is how you would alter the 'src' property in code:

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
AdobeReader.src = "C:\mydoc.pdf"
End Sub
 

Shaun57

New member
Local time
Today, 06:00
Joined
Jun 24, 2015
Messages
3
Thanks Salhford

The Sehell Execute line worked a Treat for me

You should try the following code :

Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

Private Sub Command_Click()
strDir = "<your files Directory>"
strFile = "<your filename>.pdf"
ShellExecute 0, "OPEN", strDir & strFile, "", strDir, 1
End Sub
 

Users who are viewing this thread

Top Bottom