Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dont show the acrobat window during the printing

Status
Not open for further replies.

sal21

Programmer
Apr 26, 2004
428
IT
my code:

Private Sub STAMPA_PDF()

'STAMPA FILE PDF
Dim LNGRET As Long
TerminateProcess "Acrobat.exe"
LNGRET = ShellExecute(0, "print", PATHPDF, vbNullString, vbNullString, SW_HIDE)
Sleep (2000)
TerminateProcess "Acrobat.exe"
'STAMPA FILE PDF

End Sub

i need to printing the pdf but wotouth to show the Acrobat window, possible?

note:
tested with const SW_HIDE=0, but the window show again!
 
Sadly, the behaviour of SW_HIDE is far from guaranteed if you pass a document (as you are doing) to the ShellExecute function. I'm unaware of any obvious workaround - although you might try SW_MINIMIZED instead if you can live with a taskbar icon appearing and disappearing. This, by the way, seems to be the default way it works on my PC when using SW_HIDE, but I only have Acrobat Reader installed rather than the full Acrobat, so that may make a difference (when passing a document it is up to the associated application that launches to decide how to respond to SW_HIDE, not the Shell)

Another possibility would be to try ShellExecuteEx. Whilst this suffers the same drawback as ShellExecute regarding SW_HIDE, it has the advantage that you can retrieve the process handle that is launched, which in turn means you can determine the top level window associated, and thus change is appearance. Probably; I have not tried to put any code this to test this.

 
Can the webbrowser control - open and print pdf document - be a workaround?

combo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top