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

Created an attachment (id=23537)
 --> (
the PrintRenderer

The attached PrintRenderer uses the Java Print Service API, introduced in Java
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();

// 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:
------- You are receiving this mail because: -------
You are the assignee for the bug.

Reply via email to