Avatar of ybt
ybt
 asked on

How to send selected .PDF files to printer from Powerbuilder 8

We are giving to a user option to select pdf files from a list and then he suppose to send this files to a printer without opening them. What should I do?
Sybase DatabaseProgramming TheoryProgrammingApplication Servers

Avatar of undefined
Last Comment
ybt

8/22/2022 - Mon
virtuadept

You're going to have to define an external function to do a command shell. And then call acrobat reader with the parameters to specify printing on command line.

This is format for external command shell:

FUNCTION long ShellExecute (uint  ihwnd,string  lpszOp,string
   lpszFile,string  lpszParams, string  lpszDir,int  wShowCmd )
   LIBRARY "Shell32.dll" ALIAS FOR "ShellExecuteW"

This is the help for the adobe acrobat reader print via command line.

AcroRd32.exe /t path "printername" "drivername" "portname" — Start Adobe Reader and print a file while suppressing the Print dialog box. The path must be fully specified.
The four parameters of the /t option evaluate to path, printername, drivername, and portname (all strings).
printername — The name of your printer.
drivername — Your printer driver’s name, as it appears in your printer’s properties.
portname — The printer’s port. portname cannot contain any "/" characters; if it does, output is routed to the default port for that printer.

Of course, you've got to specify this dynamically by reading the right values from the specific user's environment.
virtuadept

Just checking if that previous answer was helpful or not?
ASKER CERTIFIED SOLUTION
ybt

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
virtuadept

You can read the Windows registry to get printer driver information, but your solution of writing them out to one PDF and opening Acrobat Reader is probably best because it will let them use the Reader printer dialog features in that which do some resizing and nice features.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
ybt

ASKER
This is nit exactly what I wanted, but it works
ybt

ASKER
This is nit exactly what I wanted, but it works