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

Printing a PDF file in VFP

Status
Not open for further replies.

foxbldr

Programmer
Apr 16, 2002
109
CA
Hi all,

I want to load a pdf file into VFP and print to the printer in the background (without opening pdf viewer).

I tried using pdf.pdfctrl.5 but it is crashing at Loadfile method(catastrophic error)


Can somebody gimme some clues.

Foxbldr
 
Try this:

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

ShellExecute(0, "print", "MyPDFFile.PDF", "", "", 1)

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
Just in addition when using a pdf-printer:
Be aware that sometimes after using the pdf-printer your default path has changed.
I use to have a 'set defa to gcDefaultdir' after the print command. Where as gcDefaultDir is a global var defined in my start-up.prg.
 
Mike,
Does ShellExecute close Acrobat window after printing?
Actuallly, I am sending faxes in DCX format while converting PDF to DCX using a printer driver and it is an unattended process.

Thank you for the reply.

Foxbldr

 
Foxbldr,

Does ShellExecute close Acrobat window after printing?

No, ShellExecute only launches the applicatoin. It does not know how to close it. But the application might or might not close itself when the printing is finished. Why don't you try it and see.

Keep in mind that the code I gave you is not specific to the Acrobat reader. It will use whatever application is associated with the PDF file extension. If the Acrobat program doesn't work for you, you could always look for another PDF utility that does the job better.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
Thanks Mike.

I will give it a try. I remember reading your article on (Foxpro Advisor or somewhere...can't remember) that described usage of ShellExecute.


Foxbldr

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top