From bed433ffcf140df177972d7a00c5903140b1d83c Mon Sep 17 00:00:00 2001 From: arved Date: Sat, 10 Mar 2001 19:02:09 +0000 Subject: [PATCH] Updates due to PCL support git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194149 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/fop/apps/CommandLineOptions.java | 51 ++++++++++++++++++- src/org/apache/fop/apps/Driver.java | 14 +++++ 2 files changed, 63 insertions(+), 2 deletions(-) diff --git a/src/org/apache/fop/apps/CommandLineOptions.java b/src/org/apache/fop/apps/CommandLineOptions.java index ccac4966d..c3abeeb78 100644 --- a/src/org/apache/fop/apps/CommandLineOptions.java +++ b/src/org/apache/fop/apps/CommandLineOptions.java @@ -36,6 +36,10 @@ public class CommandLineOptions { private static final int MIF_OUTPUT = 3; /* output: sent swing rendered file to printer */ private static final int PRINT_OUTPUT = 4; + /* output: pcl file */ + private static final int PCL_OUTPUT = 5; + /* output: text file */ + private static final int TXT_OUTPUT = 6; /* use debug mode*/ Boolean errorDump = null; @@ -177,8 +181,37 @@ public class CommandLineOptions { printUsagePrintOutput(); } } - } - else if (args[i].charAt(0) != '-') { + } else if (args[i].equals("-pcl")) { + if (outputmode == NOT_SET) { + outputmode = PCL_OUTPUT; + } else { + MessageHandler.errorln("ERROR: you can only set one output method"); + printUsage(); + } + if ((i + 1 == args.length) || + (args[i + 1].charAt(0) == '-')) { + MessageHandler.errorln("ERROR: you must specify the pdf output file"); + printUsage(); + } else { + outfile = new File (args[i + 1]); + i++; + } + } else if (args[i].equals("-txt")) { + if (outputmode == NOT_SET) { + outputmode = TXT_OUTPUT; + } else { + MessageHandler.errorln("ERROR: you can only set one output method"); + printUsage(); + } + if ((i + 1 == args.length) || + (args[i + 1].charAt(0) == '-')) { + MessageHandler.errorln("ERROR: you must specify the pdf output file"); + printUsage(); + } else { + outfile = new File (args[i + 1]); + i++; + } + } else if (args[i].charAt(0) != '-') { if (inputmode == NOT_SET) { inputmode = FO_INPUT; fofile = new File (args[i]); @@ -272,6 +305,10 @@ public class CommandLineOptions { return Driver.RENDER_MIF; case PRINT_OUTPUT: return Driver.RENDER_PRINT; + case PCL_OUTPUT: + return Driver.RENDER_PCL; + case TXT_OUTPUT: + return Driver.RENDER_TXT; default: throw new FOPException("Invalid Renderer setting!"); } @@ -411,6 +448,8 @@ public class CommandLineOptions { " -pdf outfile input will be rendered as pdf file (outfile req'd) \n" + " -awt input will be displayed on screen \n" + " -mif outfile input will be rendered as mif file (outfile req'd)\n" + + " -pcl outfile input will be rendered as pcl file (outfile req'd) \n" + + " -txt outfile input will be rendered as text file (outfile req'd) \n" + " -print input file will be rendered and sent to the printer \n" + " see options with \"-print help\" \n\n" + " [Examples]\n" + " Fop foo.fo foo.pdf \n" + @@ -483,6 +522,14 @@ public class CommandLineOptions { MessageHandler.logln("out file: " + outfile.toString()); } break; + case PCL_OUTPUT: + MessageHandler.logln("pcl"); + MessageHandler.logln("output file: " + outfile.toString()); + break; + case TXT_OUTPUT: + MessageHandler.logln("txt"); + MessageHandler.logln("output file: " + outfile.toString()); + break; default: MessageHandler.logln("unknown input type"); } diff --git a/src/org/apache/fop/apps/Driver.java b/src/org/apache/fop/apps/Driver.java index 9bb0099c4..3f2dfa86a 100644 --- a/src/org/apache/fop/apps/Driver.java +++ b/src/org/apache/fop/apps/Driver.java @@ -103,6 +103,12 @@ public class Driver { /** Render to PRINT. No OutputStream neccessary */ public static final int RENDER_PRINT = 5; + /** Render to PCL. OutputStream must be set */ + public static final int RENDER_PCL = 6; + + /** Render to Text. OutputStream must be set */ + public static final int RENDER_TXT = 7; + /** the FO tree builder */ private FOTreeBuilder _treeBuilder; @@ -207,6 +213,8 @@ public class Driver { *
  • RENDER_AWT *
  • RENDER_MIF *
  • RENDER_XML + *
  • RENDER_PCL + *
  • RENDER_TXT * * @param renderer the type of renderer to use */ @@ -221,6 +229,12 @@ public class Driver { throw new IllegalArgumentException("Use renderer form of setRenderer() for AWT"); case RENDER_PRINT: throw new IllegalArgumentException("Use renderer form of setRenderer() for PRINT"); + case RENDER_PCL: + setRenderer(new org.apache.fop.render.pcl.PCLRenderer()); + break; + case RENDER_TXT: + setRenderer(new org.apache.fop.render.txt.TXTRenderer()); + break; case RENDER_MIF: setRenderer(new org.apache.fop.render.mif.MIFRenderer()); break; -- 2.39.5