A Java program that prints a PDF document using some of the print request attributes available using Qoppa’s library jPDFPrint.

// Load the PDF document
PDFPrint pdfPrint = new PDFPrint("input.pdf", null);
 
// Create attribute set to print to a file
HashPrintRequestAttributeSet attrSet = new HashPrintRequestAttributeSet();
attrSet.add(PrintQuality.HIGH);
attrSet.add(Chromaticity.MONOCHROME);
 
// Send the PDF to the printer
pdfPrint.print ("printer name", null, attrSet);

Possible PrintJobAttribute are:

Chromaticity, Copies, DateTimeAtCompleted, DateTimeAtCreation, DateTimeAtProcessing, Destination, Fidelity, Finishings, JobHoldUntil, JobImpressions, JobImpressionsCompleted, JobKOctets, JobKOctetsProcessed, JobMediaSheets, JobMediaSheetsCompleted, JobMessageFromOperator, JobName, JobOriginatingUserName, JobPriority, JobSheets, JobState, JobStateReasons, Media, MediaName, MediaPrintableArea, MediaSizeName, MediaTray, MultipleDocumentHandling, NumberOfDocuments, NumberOfInterveningJobs, NumberUp, OrientationRequested, OutputDeviceAssigned, PageRanges, PresentationDirection, PrinterResolution, PrintQuality, SheetCollate, Sides


PrintWithAttributes
PrintWithAttributes
PrintWithAttributes.java
968.0 B
543 Downloads
Details