Solved

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

Posted on 2013-02-01
7
604 Views
Last Modified: 2013-11-18
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?
0
Comment
Question by:ybt
  • 3
  • 3
7 Comments
 
LVL 8

Expert Comment

by:virtuadept
ID: 38852365
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.
0
 
LVL 8

Expert Comment

by:virtuadept
ID: 38864021
Just checking if that previous answer was helpful or not?
0
 

Accepted Solution

by:
ybt earned 0 total points
ID: 38864095
Thank you, but this solution is not  working for PowerBuilder, it cannot find printername,
drivername, and portname automatically, it will open a dialog box, but this is not what I need, in this case I can combine all docs in one and open with Adobe and user will be able to click on adobe printer...
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 8

Expert Comment

by:virtuadept
ID: 38864158
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.
0
 

Author Comment

by:ybt
ID: 39645743
This is nit exactly what I wanted, but it works
0
 

Author Closing Comment

by:ybt
ID: 39655992
This is nit exactly what I wanted, but it works
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
A short article about problems I had with the new location API and permissions in Marshmallow
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now