Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to print the PDF without opening the Acrobat Application

1,702 views
Skip to first unread message

Sarathu

unread,
Jan 6, 2010, 5:57:20 AM1/6/10
to
Hello,

I am working in the POwer Builder 9 and my criteria is to print the
PDF files without opening the application and the code which i am
using this purpose is

ShellExecute( 0, 'open', ls_filename, ls_null, ls_filepath,3)

but that doesn't work..

anybody guide me to get the solution

Jeremy Lakeman

unread,
Jan 6, 2010, 8:02:31 AM1/6/10
to

when you drag a pdf file directly onto a printer's icon, it issues a
shell execute "printto" command (instead of open as in your example)
passing the printer name as a parameter. I'm certain with a little
more research you can work out the rest...

Will

unread,
Jan 6, 2010, 11:12:34 AM1/6/10
to

Sarathu,


Here is the declaration:

FUNCTION long ShellExecuteW (long hwnd, string lpOperation, string
lpFile, string lpParameters, string lpDirectory,integer nShowCmd )
LIBRARY "shell32"

The call:

//Set temp pdf printer driver
ls_set_printer = 'PDFCreator,winspool,Ne00:' //New printer name, we
use PDF creator.
li_rtn = RegistryGet( 'HKEY_CURRENT_USER\Software\Microsoft\Windows NT
\CurrentVersion\Windows' , 'Device', RegString!, ls_current_printer)
li_rtn = RegistrySet( 'HKEY_CURRENT_USER\Software\Microsoft\Windows NT
\CurrentVersion\Windows' , 'Device', RegString!, ls_set_printer)
ll_handle = Handle(this)
SetNull(ls_null)

ShellExecuteW ( ll_handle, 'print', ls_word_filename, ls_null,
ls_directory, 3)

//Then reset back to current printer once PDF printing is done.
RegistrySet( 'HKEY_CURRENT_USER\Software\Microsoft\Windows NT
\CurrentVersion\Windows', 'Device', RegString!, ls_current_printer)

Scott Morris

unread,
Jan 6, 2010, 8:00:32 AM1/6/10
to
"Sarathu" <sara...@gmail.com> wrote in message
news:85144d7c-8331-46b9...@k19g2000yqc.googlegroups.com...

> Hello,
>
> I am working in the POwer Builder 9 and my criteria is to print the

Always identify the version AND BUILD that you are using.

> PDF files without opening the application and the code which i am
> using this purpose is
>
> ShellExecute( 0, 'open', ls_filename, ls_null, ls_filepath,3)
>
> but that doesn't work..

Define "doesn't work". The "open" verb obviously isn't what you want - did
you try "print". What is the value of ls_filepath? Did you read the
documentation about the shellexecute function on MSDN to verify that you are
using it correctly? What is the return value of the function?

>
> anybody guide me to get the solution

From a technical standpoint, this method does invoke the associated
application but relieves you from having to determine all the details about
which application is intended for this file type. As stated, your
requirements cannot be met - some program must be invoked to accomplish the
printing.


Arthur Hefti

unread,
Jan 6, 2010, 8:00:39 AM1/6/10
to
Use "print" instead of "open"

Arthur
--

Sarathu

unread,
Jan 7, 2010, 1:29:09 AM1/7/10
to
> > anybody guide me to get the solution- Hide quoted text -
>
> - Show quoted text -

Thanks for reply
Sorry that was a mistake ...Actually that was 'print' but then also
that doesn't work

Bruce Armstrong

unread,
Jan 8, 2010, 10:14:00 AM1/8/10
to

You want to use printto rather than open.

Note that the Adobe Reader is the only application I've seen that
remains open after you print something using that method. You may
need to address that as well.

http://www.biopdf.com/acrowrap/close_adobe_reader.php


On Wed, 6 Jan 2010 02:57:20 -0800 (PST), Sarathu <sara...@gmail.com>
wrote:

-----------------------------------

My Web 2.0 Stuff

Blog: http://bruce.pbdjmagazine.com/
Facebook: http://www.facebook.com/people/Bruce-Armstrong/1600223798
Fotki: http://public.fotki.com/brucearmstrong/
LinkedIn: http://www.linkedin.com/in/bruceaarmstrong
Twitter: http://twitter.com/bruce_armstrong
YouTube: http://www.youtube.com/user/brucearmstrong

0 new messages