From 03053c32f4d6b8ce250d58826e165cbc2873e64a Mon Sep 17 00:00:00 2001 From: Jeremias Maerki Date: Thu, 9 Jun 2005 13:15:59 +0000 Subject: [PATCH] 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 --- .../org/apache/fop/apps/CommandLineOptions.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) 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" -- 2.39.5