Discussion:
how to print a PDF file ?
(too old to reply)
eric wu
2008-09-15 04:00:42 UTC
Permalink
Thank you!!

how to modify the codes to allow choosing printer ?
On Tue, 9 Sep 2008 18:41:31 -0500
is it possible to write a .prg to send a selected pdf file
#define SW_SHOWNORMAL 1
#define SW_SHOWMINIMIZED 2
#define SW_SHOWMAXIMIZED 3
#define SW_SHOWNOACTIVATE 4
#define SW_SHOW 5
if type("ShellExecute") # "FP"
extern cHandle ShellExecute;
(cHandle, cstring, cstring, cstring, ;
cstring, CINT) shell32 ;
from "ShellExecuteA"
endif
nHandle =
ShellExecute(0,"PRINT",cFileName,null,null,SW_SHOWNOACTIVATE)
Magic! <g>
As it stands, the document will print to the default printer without any
options and without opening. Mind you, I only tried it with a single page
document so the possibility exists that with a multi-page document the
dialog will open to allow one to specify the pages to be printed.
If, however, one changes the "PRINT" to "OPEN" then the document opens in
the registered reader (Adobe Reader 8 in my case) and one can use the
normal Print icon on the toolbar to select pages, printer and so on.
Mervyn.
Mervyn Bick
2008-09-15 14:37:11 UTC
Permalink
Post by eric wu
Thank you!!
how to modify the codes to allow choosing printer ?
#define SW_SHOWNORMAL 1
#define SW_SHOWMINIMIZED 2
#define SW_SHOWMAXIMIZED 3
#define SW_SHOWNOACTIVATE 4
#define SW_SHOW 5
cFileName = "c:\pdf995\output\brain_1.pdf"
if type("ShellExecute") # "FP"
extern cHandle ShellExecute;
(cHandle, cstring, cstring, cstring, ;
cstring, CINT) shell32 ;
from "ShellExecuteA"
endif
nHandle = ShellExecute(0,"open",cFileName,null,null,SW_SHOWNOACTIVATE)


This will open the document in the registered .PDF reader (Acrobat 8 in my
case) in it's last used state. It might be prudent to replace
SW_SHOWNOACTIVATE with SW_SHOWMAXIMIZED so that the reader always opens
maximised and not as it was left the last time it was used.

Once the document is opened you can print it by either clicking on the
printer icon on the tool-bar or select from the menu File->Print. This
will open the print dialog box which has a combobox at the top which shows
the Windows default printer to start with. You can use this control to
select any other instaled printer.



Mervyn.

Loading...