https://issues.apache.org/bugzilla/show_bug.cgi?id=47093
Summary: [patch] a PrintRenderer using Java Print Service API
Product: Fop
Version: all
Platform: All
OS/Version: All
Status: NEW
Severity: enhancement
Priority: P2
Component: general
AssignedTo: [email protected]
ReportedBy: [email protected]
Created an attachment (id=23537)
--> (https://issues.apache.org/bugzilla/attachment.cgi?id=23537)
the PrintRenderer
The attached PrintRenderer uses the Java Print Service API, introduced in Java
1.4.
It allows to programmatically set print options, like the destination printer
and media tray. I use it like this:
// Construct a FopFactory
FopFactory fopFactory = FopFactory.newInstance();
FOUserAgent userAgent = fopFactory.newFOUserAgent();
// Setup FOP print renderer
PrintRenderer renderer = new PrintRenderer();
renderer.setUserAgent(userAgent);
userAgent.setRendererOverride(renderer);
// Construct fop with desired output format
Fop fop = fopFactory.newFop(MimeConstants.MIME_FOP_PRINT, userAgent);
ContentHandler handler = fop.getDefaultHandler();
// lookup a printer
PrintService service = PrintServiceLookup.lookupDefaultPrintService();
DocPrintJob job = service.createPrintJob();
PrintRequestAttributeSet attributes = new HashPrintRequestAttributeSet();
// set print request attributes here, like the media tray
// print
job.print(renderer, attributes);
If this PrintRenderer replaced the current one (hint, hint), I could skip the
"Setup FOP print renderer" section.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.