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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing HTML Docs 2

Status
Not open for further replies.

Ferdalizer

Programmer
Jun 29, 2004
19
US
Greetings!

I have an app that is processing and printing over 1100 html documents and I am using:

DECLARE INTEGER ShellExecute IN shell32.dll ;
INTEGER hndWin, STRING cAction, STRING cFileName, ;
STRING cParams, STRING cDir, INTEGER nShowWin

=ShellExecute(0,"PRINT","MyHTML.HTM","","",1)

The only problem is that I have to hit print everytime.

Is there a way to avoid opening the print dialog?

Thanks in advance!

Fred
 
Try changing the last parameter to 0. If that does not work - take a look at my shellexecute example (applaunch) in thread: Printing a TIFF file from VFP
thread184-944857

Jim Osieczonek
Delta Business Group, LLC
 
Try this.

Brian

Code:
STRTOFILE([Test],[c:\data\test\test.htm])

lcfile=[c:\data\test\test.htm]

DECLARE INTEGER FindWindow IN user32; 
    STRING lpClassName,; 
    STRING lpWindowName 

WAIT WINDOW NOWAIT "Please Standby. Printing "+lcfile
WshShell = CreateObject("WScript.Shell")
loWeb = CreateObject("InternetExplorer.Application")
     WITH loWeb 
     .Height = -1
     .Visible = .t.
     .Navigate(lcfile)
     WshShell.AppActivate("Internet Explorer 6")
     .ExecWB(6, 2, 0, 0)
     .Quit 
     ENDWITH
loWeb=.null.
WshShell=.null.
WAIT CLEAR
 

Another alternative - it's important that the page is complete before printing begins, hence the DO WHILE... loop.

Internet Explorer has predetermined margins which may require adjustment, headers and footers which may be undesirable and will not print background colours and images, all this by default.
Code:
[COLOR=blue]lcUrlName = [c:\data\test\test.htm]
oIE = CREATEOBJECT([InternetExplorer.Application])
oIE.Navigate(lcUrlName)
DO WHILE oIE.Busy ;
[tab][tab]OR oIE.ReadyState # 4
[tab]DOEVENTS
ENDDO
oIE.ExecWB(6,2,0,0)

oIE.Quit
RELE oIE
oIE = .NULL.[/color]

FAQ184-2483 - answering getting answered.​
Chris [pc2]
PDFcommander[sup]tm[/sup].com
PDFcommander[sup]tm[/sup].co.uk


 
Jimoo,

I did try changing the last parameter to 0. It did not stop the print dialog from opening.


Thanks though, I appreciate any and all input!
 
Thanks Brian & Chris. That's what I was looking for! 8)


Fred
 
Ferdalizer

Changing the parameter to 0 was a guess, but the applaunch code I pointed you to is well tested and works fine for opening or printing just about any kind of filetype.



Jim Osieczonek
Delta Business Group, LLC
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top