aboutsummaryrefslogtreecommitdiffstats
path: root/src/java
diff options
context:
space:
mode:
authorJeremias Maerki <jeremias@apache.org>2005-06-09 13:15:59 +0000
committerJeremias Maerki <jeremias@apache.org>2005-06-09 13:15:59 +0000
commit03053c32f4d6b8ce250d58826e165cbc2873e64a (patch)
treef53af5e17b3aba54f8dcea2cd85e0478a60b9d42 /src/java
parentdb8bc76cbeac7ea6bc3c4b59f455e767073190e4 (diff)
downloadxmlgraphics-fop-03053c32f4d6b8ce250d58826e165cbc2873e64a.tar.gz
xmlgraphics-fop-03053c32f4d6b8ce250d58826e165cbc2873e64a.zip
Command-line switch for setting the resolution.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@198732 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java')
-rw-r--r--src/java/org/apache/fop/apps/CommandLineOptions.java16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/java/org/apache/fop/apps/CommandLineOptions.java b/src/java/org/apache/fop/apps/CommandLineOptions.java
index 1462397e0..434fb8be1 100644
--- a/src/java/org/apache/fop/apps/CommandLineOptions.java
+++ b/src/java/org/apache/fop/apps/CommandLineOptions.java
@@ -1,5 +1,5 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 1999-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -151,6 +151,8 @@ public class CommandLineOptions implements Constants {
setLogLevel("debug");
} else if (args[i].equals("-r")) {
foUserAgent.setStrictValidation(false);
+ } else if (args[i].equals("-dpi")) {
+ i = i + parseResolution(args, i);
} else if (args[i].equals("-q") || args[i].equals("--quiet")) {
setLogLevel("error");
} else if (args[i].equals("-fo")) {
@@ -235,6 +237,17 @@ public class CommandLineOptions implements Constants {
}
}
+ private int parseResolution(String[] args, int i) throws FOPException {
+ if ((i + 1 == args.length)
+ || (args[i + 1].charAt(0) == '-')) {
+ throw new FOPException(
+ "if you use '-dpi', you must specify a resolution (dots per inch)");
+ } else {
+ foUserAgent.setResolution(Integer.parseInt(args[i + 1]));
+ return 1;
+ }
+ }
+
private int parseFOInputOption(String[] args, int i) throws FOPException {
inputmode = FO_INPUT;
if ((i + 1 == args.length)
@@ -643,6 +656,7 @@ public class CommandLineOptions implements Constants {
+ " -c cfg.xml use additional configuration file cfg.xml\n"
+ " -l lang the language to use for user information \n"
+ " -r relaxed/less strict validation (where available)\n"
+ + " -dpi xxx resolution in dots per inch (dpi) where xxx is a number\n"
+ " -s for area tree XML, down to block areas only\n"
+ " -v to show FOP version being used\n\n"
+ " [INPUT] \n"