Solved

Print pdf

Posted on 2006-06-09
10
330 Views
Last Modified: 2010-04-07
How can i print a pdf.
The only thing is that there are different users with different versions of acrobat reader.

I've read something about pdf.ocx but a im afraid that it won't work with multiple versions.

If needbe i can use vb5/vb6/ 2005.net

0
Comment
Question by:dgb
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
10 Comments
 
LVL 70

Assisted Solution

by:Éric Moreau
Éric Moreau earned 250 total points
ID: 16871422
Hi dgb,

In .Net, you can use the Process component:
Dim MyProcess As New Process
MyProcess.StartInfo.FileName = "c:\temp\test.pdf"
MyProcess.StartInfo.Verb = "Print"
MyProcess.Start()


Cheers!
0
 
LVL 52

Accepted Solution

by:
Ryan Chong earned 250 total points
ID: 16871989
in vb5/6, you can try use the ShellExecute API to print a document, like:

Public 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
Public Declare Function GetDesktopWindow Lib "user32" () As Long

Public Function PrintDoc(ByVal FileName As String, Optional CommandLine As String = "") As Long
    Dim Scr_hDC As Long
    Scr_hDC = GetDesktopWindow()
    'change "Open" to "Explore" to bring up file explorer
    PrintDoc = ShellExecute(Scr_hDC, "Print", FileName, CommandLine, vbNullString, 1)
End Function

then:

Private Sub Command1_Click()
    tmp = "c:\test.pdf"
    PrintDoc tmp
End Sub
0
 

Author Comment

by:dgb
ID: 16877056
Is it possible to control the printer on wich the pdf is printed.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:dgb
ID: 16877127
emoreau :
I've tryed the code you've mentiond and it works but the reader doesn't close by itself.
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 16877665
It depends on the version of Acrobat you have. On the server where my application runs, Acrobat (v 5.0 I think) closes by itself.  On my PC, it doesn't (recent version).
0
 

Author Comment

by:dgb
ID: 16883408
Can i force the application to close, it also looks for updates, very annoying.
0
 

Author Comment

by:dgb
ID: 17120156
anyone ??
0
 

Author Comment

by:dgb
ID: 17308421
Thanks everybody,

To bad no one responded to my last question though.
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
JSON Response and request in VB6 application 11 1,081
bit defender blocks good applications 2 121
to transfer string from C lanaguage to VBA 4 85
Macro problems with Excel file 6 53
There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question