Solved

Print pdf

Posted on 2006-06-09
10
331 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
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 

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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…
Suggested Courses
Course of the Month9 days, 1 hour left to enroll

617 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