Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sending PDF file directly to printer
Message
 
To
06/10/2004 17:41:53
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Miscellaneous
Thread ID:
00940669
Message ID:
00949414
Views:
54
Carlos,

See my notes below

>DECLARE INTEGER ShellExecute ;
>IN SHELL32.DLL ;
>INTEGER nWinHandle,;
>STRING cOperation,;
>STRING cFileName,;
>STRING cParameters,;
>STRING cDirectory,;
>INTEGER nShowWindow
>? ShellExecute(0,"print", FullPath('MyFile.pdf'),"",0)

One parameter is missing. Should be:
? ShellExecute(0,"print", FullPath('MyFile.pdf'),"","",0)

>
>---------------------------------------------------------
>I just read this thread
>
>I have some questions
>
>1.I changed the parameter order because it did’t work
>
>? ShellExecute(0,"print", “MyFile.pdf”,'',”Path”,0)
>
>2. It opens the Adobe Reader and don’t close it
>What I can I do?

Something like this:
IF ShellExecute(0,"print", FullPath('MyFile.pdf'),"","",1)>32  

	oShell = CreateObject("WScript.Shell")
	*wait for Acrobat reader
	lntimeout=60
	lnstarttime=SECONDS()
	DO WHILE not oShell.AppActivate("Acrobat Reader") AND ;
		    SECONDS()-lnstarttime<lntimeout
	     INKEY(2)
	ENDDO

	IF oShell.AppActivate("Acrobat Reader")
	  *While printing Acrobat reader cannot be closed; so repeat 
          *                attempts to close it.
		lnstarttime=SECONDS()
		DO WHILE oShell.AppActivate("Acrobat Reader") AND ;
                           SECONDS()-lnstarttime<lntimeout
		    oShell.SendKeys("^q")   && try to close Acrobat reader
		    INKEY(2)
		enddo
	endif

	oShell=.null.
ELSE
	?"file not found "
ENDIF
>
>3 How can I change printer

One of the ways is:
oWSHNet = CREATEOBJECT('Wscript.Network')
oWSHNet.SetDefaultPrinter('Windows_Printer_Name')
oWSHNet =null

>
>TIA

Good Luck
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform