|
-
May 1st, 2002, 08:39 PM
#1
Thread Starter
New Member
Printing a file from a VB Program
How can I print a pdf file saved on my hard disk from within a VB program. Please help
-
May 1st, 2002, 08:59 PM
#2
I wonder how many charact
The only way I could imagine you printing a PDF file from another application would be
1) IF Adobet released a control plug-in to work with VB or C++
2) I don't think they would, since that's their technology, and that's how they make money.
Other than using API to directly open the file and hope to god that the system opens Acrobat Reader (Writer) for you, there would still be no way I know to print the file.
You should contact Adobe on this and see what they say...
-
May 2nd, 2002, 04:02 AM
#3
Hyperactive Member
Use Shell to Run This
Code:
C:\Program Files\Adobe\Acrobat 5.0\Reader\AcroRd32.exe /p /h C:\Test.pdf"
Visual Baisc 6 (SP5)
Windows Xp
-
May 2nd, 2002, 04:32 AM
#4
That way only works for version 5.0 of acrobat reader, this will work for any version:
VB 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 Form_Load()
'KPD-Team 1998
'URL: [url]http://www.allapi.net/[/url]
ShellExecute Me.hwnd, “print”, "c:\test.pdf", vbNullString, "C:\", 0
End Sub
-
May 2nd, 2002, 05:01 AM
#5
Bouncy Member
you can also do it in your app using the pdf.ocx
add the control pdf.ocx to your project from
C:\Program Files\Adobe\Acrobat 4.0\Reader\ActiveX\pdf.ocx
VB Code:
Option Explicit
Private Sub Command1_Click()
Pdf1.src = "C:\TEST.PDF"
Pdf1.printAll
End Sub
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
|