aspose file tools*
The moose likes Java in General and the fly likes Java Silent Print PDF file with printer configuration Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Java Silent Print PDF file with printer configuration" Watch "Java Silent Print PDF file with printer configuration" New topic
Author

Java Silent Print PDF file with printer configuration

sara sin
Greenhorn

Joined: Dec 16, 2010
Posts: 5

How can I print the PDF file with windows printer configuration?

For example, I have 3 print queues in my windows XP.
Print Queue A - Configured Black and White
Print Queue B - Configured Color
Print Queue C - Configured Color and Staple

If I use Adobe Reader to print the PDF file, it will print whatever the print queue configured.

For example, I print the PDF in Adobe Reader by selecting Print Queue C, the printed file will be colored and stapled.

I printed in java but never take Print Queue C configuration. The following is my code.




Please help.
Thakur Sachin Singh
Ranch Hand

Joined: Jun 15, 2010
Posts: 232

you got any exception in this code??


SCJP 6- 91%, IBM DB2, IBM RAD Certified
Hebert Coelho
Ranch Hand

Joined: Jul 14, 2010
Posts: 754

Hello sara, welcome to JavaRanch.

Is there any error? The file is corrupted in the end?


[uaiHebert.com] [Full WebApplication JSF EJB JPA JAAS with source code to download] One Table Per SubClass [Web/JSF]
sara sin
Greenhorn

Joined: Dec 16, 2010
Posts: 5

Thanks for your reply.

No error / exception. The PDF file was printed successfully but not using Print Queue C configuration (Color and Stapled), printed without stapled.

Do you know why?
sara sin
Greenhorn

Joined: Dec 16, 2010
Posts: 5

Any Update?
sara sin
Greenhorn

Joined: Dec 16, 2010
Posts: 5

If I set got the following error.

sun.print.PrintJobAttributeException: unsupported category: class javax.print.attribute.standard.Finishings
at sun.print.Win32PrintJob.getAttributeValues(Unknown Source)
at sun.print.Win32PrintJob.print(Unknown Source)
sara sin
Greenhorn

Joined: Dec 16, 2010
Posts: 5

After many days of research, I know that is difficult to send PDF files to Print Queue directly from Java.
And difficult for Java to use the Print Queue function like Staple and etc.
Because Print Queue is running on OS and Java is running on JVM.
And all the function in the Print Queue are supported by the driver and the driver is provided by the printer company like Canon or etc.
And Canon didn't provided any Java API to use the printer function.

I have decided to use a third party tool (http://www.commandlinepdf.com/) to do this.
If you dont want to pay then you can use Adobe Reader to print but Adobe Reader Windows can't close after print.

The following is my code.



Hope this will help.
 
 
subject: Java Silent Print PDF file with printer configuration