You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by je...@apache.org on 2009/10/07 16:22:35 UTC
svn commit: r822753 -
/xmlgraphics/fop/trunk/src/java/org/apache/fop/cli/CommandLineOptions.java
Author: jeremias
Date: Wed Oct 7 14:22:35 2009
New Revision: 822753
URL: http://svn.apache.org/viewvc?rev=822753&view=rev
Log:
Allow "-if [mime] out" as for "-at".
Modified:
xmlgraphics/fop/trunk/src/java/org/apache/fop/cli/CommandLineOptions.java
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/cli/CommandLineOptions.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/cli/CommandLineOptions.java?rev=822753&r1=822752&r2=822753&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/cli/CommandLineOptions.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/cli/CommandLineOptions.java Wed Oct 7 14:22:35 2009
@@ -30,9 +30,10 @@
import javax.swing.UIManager;
+import org.xml.sax.SAXException;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.xml.sax.SAXException;
import org.apache.fop.Version;
import org.apache.fop.apps.FOPException;
@@ -45,7 +46,9 @@
import org.apache.fop.pdf.PDFXMode;
import org.apache.fop.render.Renderer;
import org.apache.fop.render.awt.AWTRenderer;
-import org.apache.fop.render.intermediate.IFRenderer;
+import org.apache.fop.render.intermediate.IFContext;
+import org.apache.fop.render.intermediate.IFDocumentHandler;
+import org.apache.fop.render.intermediate.IFSerializer;
import org.apache.fop.render.pdf.PDFRenderer;
import org.apache.fop.render.print.PagesMode;
import org.apache.fop.render.print.PrintRenderer;
@@ -209,13 +212,19 @@
//Make sure the prepared XMLRenderer is used
foUserAgent.setRendererOverride(xmlRenderer);
- } else if (MimeConstants.MIME_FOP_IF.equals(outputmode)) {
+ } else if (MimeConstants.MIME_FOP_IF.equals(outputmode)
+ && mimicRenderer != null) {
// render from FO to Intermediate Format
- IFRenderer xml2Renderer = new IFRenderer();
- xml2Renderer.setUserAgent(foUserAgent);
+ IFSerializer serializer = new IFSerializer();
+ serializer.setContext(new IFContext(foUserAgent));
+
+ IFDocumentHandler targetHandler
+ = foUserAgent.getRendererFactory().createDocumentHandler(
+ foUserAgent, mimicRenderer);
+ serializer.mimicDocumentHandler(targetHandler);
- //Make sure the prepared IFRenderer is used
- foUserAgent.setRendererOverride(xml2Renderer);
+ //Make sure the prepared serializer is used
+ foUserAgent.setDocumentHandlerOverride(serializer);
}
return true;
}
@@ -709,11 +718,12 @@
} else if ((i + 2 == args.length)
|| (args[i + 2].charAt(0) == '-')) {
// only output file is specified
- outfile = new File(args[i + 1]);
+ setOutputFile(args[i + 1]);
return 1;
} else {
// mimic format and output file have been specified
- outfile = new File(args[i + 2]);
+ mimicRenderer = args[i + 1];
+ setOutputFile(args[i + 2]);
return 2;
}
}
@@ -1167,16 +1177,18 @@
+ " -png outfile input will be rendered as PNG (outfile req'd)\n"
+ " -txt outfile input will be rendered as plain text (outfile req'd) \n"
+ " -at [mime] out representation of area tree as XML (outfile req'd) \n"
- + " specify optional mime output to allow AT to be converted\n"
+ + " specify optional mime output to allow the AT to be converted\n"
+ + " to final format later\n"
+ + " -if [mime] out representation of document in intermediate format XML (outfile req'd)\n"
+ + " specify optional mime output to allow the IF to be converted\n"
+ " to final format later\n"
- + " -if out representation of area tree as intermediate format XML (outfile req'd)\n"
+ " -print input file will be rendered and sent to the printer \n"
+ " see options with \"-print help\" \n"
+ " -out mime outfile input will be rendered using the given MIME type\n"
+ " (outfile req'd) Example: \"-out application/pdf D:\\out.pdf\"\n"
+ " (Tip: \"-out list\" prints the list of supported MIME types)\n"
- + " -mif outfile input will be rendered as MIF (FrameMaker) (outfile req'd)\n"
- + " Experimental feature - requires additional fop-sandbox.jar.\n"
+ //+ " -mif outfile input will be rendered as MIF (FrameMaker) (outfile req'd)\n"
+ //+ " Experimental feature - requires additional fop-sandbox.jar.\n"
+ " -svg outfile input will be rendered as an SVG slides file (outfile req'd) \n"
+ " Experimental feature - requires additional fop-sandbox.jar.\n"
+ "\n"
@@ -1219,7 +1231,7 @@
break;
case FO_INPUT:
log.info("FO ");
- if (this.useStdIn) {
+ if (isInputFromStdIn()) {
log.info("fo input file: from stdin");
} else {
log.info("fo input file: " + fofile.toString());
@@ -1227,7 +1239,7 @@
break;
case XSLT_INPUT:
log.info("xslt transformation");
- if (this.useStdIn) {
+ if (isInputFromStdIn()) {
log.info("xml input file: from stdin");
} else {
log.info("xml input file: " + xmlfile.toString());
@@ -1236,7 +1248,7 @@
break;
case AREATREE_INPUT:
log.info("AT ");
- if (this.useStdIn) {
+ if (isInputFromStdIn()) {
log.info("area tree input file: from stdin");
} else {
log.info("area tree input file: " + areatreefile.toString());
@@ -1244,7 +1256,7 @@
break;
case IF_INPUT:
log.info("IF ");
- if (this.useStdIn) {
+ if (isInputFromStdIn()) {
log.info("intermediate input file: from stdin");
} else {
log.info("intermediate input file: " + iffile.toString());
@@ -1252,7 +1264,7 @@
break;
case IMAGE_INPUT:
log.info("Image ");
- if (this.useStdIn) {
+ if (isInputFromStdIn()) {
log.info("image input file: from stdin");
} else {
log.info("image input file: " + imagefile.toString());
@@ -1281,7 +1293,7 @@
if (mimicRenderer != null) {
log.info("mimic renderer: " + mimicRenderer);
}
- if (this.useStdOut) {
+ if (isOutputToStdOut()) {
log.info("output file: to stdout");
} else {
log.info("output file: " + outfile.toString());
@@ -1291,7 +1303,7 @@
log.info("output file: " + outfile.toString());
} else {
log.info(outputmode);
- if (this.useStdOut) {
+ if (isOutputToStdOut()) {
log.info("output file: to stdout");
} else {
log.info("output file: " + outfile.toString());
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org