aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/embedding/java/embedding/ExampleFO2OldStylePrint.java7
1 files changed, 5 insertions, 2 deletions
diff --git a/examples/embedding/java/embedding/ExampleFO2OldStylePrint.java b/examples/embedding/java/embedding/ExampleFO2OldStylePrint.java
index a9519e35d..8d8ecd465 100644
--- a/examples/embedding/java/embedding/ExampleFO2OldStylePrint.java
+++ b/examples/embedding/java/embedding/ExampleFO2OldStylePrint.java
@@ -60,11 +60,14 @@ public class ExampleFO2OldStylePrint {
PrinterJob printerJob = PrinterJob.getPrinterJob();
printerJob.setJobName("FOP Printing Example");
- PrintRenderer renderer = new PrintRenderer(printerJob);
-
try {
//Set up a custom user agent so we can supply our own renderer instance
FOUserAgent userAgent = fopFactory.newFOUserAgent();
+
+ //Set up our own PrintRenderer instance so we can supply a special PrinterJob instance.
+ PrintRenderer renderer = new PrintRenderer(printerJob);
+ renderer.setUserAgent(userAgent);
+
userAgent.setRendererOverride(renderer);
// Construct fop with desired output format (here, it is set through the user agent)