Class CommandLineOptions

java.lang.Object
org.apache.fop.cli.CommandLineOptions

public class CommandLineOptions extends Object
Options parses the commandline arguments
  • Field Details

    • RENDER_NONE

      public static final int RENDER_NONE
      Used to indicate that only the result of the XSL transformation should be output
      See Also:
    • NOT_SET

      public static final int NOT_SET
      (input) not set
      See Also:
    • FO_INPUT

      public static final int FO_INPUT
      input: fo file
      See Also:
    • XSLT_INPUT

      public static final int XSLT_INPUT
      input: xml+xsl file
      See Also:
    • AREATREE_INPUT

      public static final int AREATREE_INPUT
      input: Area Tree XML file
      See Also:
    • IF_INPUT

      public static final int IF_INPUT
      input: Intermediate Format XML file
      See Also:
    • IMAGE_INPUT

      public static final int IMAGE_INPUT
      input: Image file
      See Also:
    • showConfiguration

      private Boolean showConfiguration
    • suppressLowLevelAreas

      private Boolean suppressLowLevelAreas
    • userConfigFile

      private File userConfigFile
    • fofile

      private File fofile
    • xsltfile

      private File xsltfile
    • xmlfile

      private File xmlfile
    • areatreefile

      private File areatreefile
    • iffile

      private File iffile
    • imagefile

      private File imagefile
    • outfile

      private File outfile
    • inputmode

      private int inputmode
    • outputmode

      private String outputmode
    • useStdIn

      private boolean useStdIn
    • useStdOut

      private boolean useStdOut
    • useCatalogResolver

      private boolean useCatalogResolver
    • renderingOptions

      private Map renderingOptions
    • targetResolution

      private float targetResolution
    • strictValidation

      private boolean strictValidation
    • conserveMemoryPolicy

      private boolean conserveMemoryPolicy
    • useComplexScriptFeatures

      private boolean useComplexScriptFeatures
    • overrideTargetResolution

      private boolean overrideTargetResolution
    • factory

      private FopFactory factory
    • foUserAgent

      private FOUserAgent foUserAgent
    • inputHandler

      private InputHandler inputHandler
    • log

      private org.apache.commons.logging.Log log
    • xsltParams

      private Vector xsltParams
    • mimicRenderer

      private String mimicRenderer
    • flushCache

      private boolean flushCache
    • baseURI

      private URI baseURI
    • cacheName

      private String cacheName
  • Constructor Details

    • CommandLineOptions

      public CommandLineOptions()
      Construct a command line option object.
  • Method Details

    • parse

      public boolean parse(String[] args) throws FOPException, IOException
      Parses the command line arguments.
      Parameters:
      args - the command line arguments.
      Returns:
      true if the processing can continue, false to abort
      Throws:
      FOPException - for general errors
      IOException - if the the configuration file could not be loaded
    • getInputHandler

      public InputHandler getInputHandler()
      Returns:
      the InputHandler instance defined by the command-line options.
    • getLogger

      public org.apache.commons.logging.Log getLogger()
      Get the logger.
      Returns:
      the logger
    • addXSLTParameter

      private void addXSLTParameter(String name, String value)
    • parseOptions

      private boolean parseOptions(String[] args) throws FOPException
      Parses the command line arguments.
      Returns:
      true if processing can continue, false if it should stop (nothing to do)
      Throws:
      FOPException - if there was an error in the format of the options
    • parseCacheOption

      private int parseCacheOption(String[] args, int i) throws FOPException
      Throws:
      FOPException
    • parseConfigurationOption

      private int parseConfigurationOption(String[] args, int i) throws FOPException
      Throws:
      FOPException
    • parseLanguageOption

      private int parseLanguageOption(String[] args, int i) throws FOPException
      Throws:
      FOPException
    • parseResolution

      private int parseResolution(String[] args, int i) throws FOPException
      Throws:
      FOPException
    • parseFOInputOption

      private int parseFOInputOption(String[] args, int i) throws FOPException
      Throws:
      FOPException
    • parseXSLInputOption

      private int parseXSLInputOption(String[] args, int i) throws FOPException
      Throws:
      FOPException
    • parseXMLInputOption

      private int parseXMLInputOption(String[] args, int i) throws FOPException
      Throws:
      FOPException
    • getBaseURI

      private URI getBaseURI(File file)
    • parseAWTOutputOption

      private int parseAWTOutputOption(String[] args, int i) throws FOPException
      Throws:
      FOPException
    • parsePDFOutputOption

      private int parsePDFOutputOption(String[] args, int i, String pdfAMode) throws FOPException
      Throws:
      FOPException
    • setOutputFile

      private void setOutputFile(String filename)
    • isOption

      private boolean isOption(String arg)
      Checks whether the given argument is the next option or the specification of stdin/stdout. TODO this is very ad-hoc and should be better handled. Consider the adoption of Apache Commons CLI.
      Parameters:
      arg - an argument
      Returns:
      true if the argument is an option ("-something"), false otherwise
    • isSystemInOutFile

      private boolean isSystemInOutFile(String filename)
    • parseMIFOutputOption

      private int parseMIFOutputOption(String[] args, int i) throws FOPException
      Throws:
      FOPException
    • parseRTFOutputOption

      private int parseRTFOutputOption(String[] args, int i) throws FOPException
      Throws:
      FOPException
    • parseTIFFOutputOption

      private int parseTIFFOutputOption(String[] args, int i) throws FOPException
      Throws:
      FOPException
    • parsePNGOutputOption

      private int parsePNGOutputOption(String[] args, int i) throws FOPException
      Throws:
      FOPException
    • parsePrintOutputOption

      private int parsePrintOutputOption(String[] args, int i) throws FOPException
      Throws:
      FOPException
    • parseCopiesOption

      private int parseCopiesOption(String[] args, int i) throws FOPException
      Throws:
      FOPException
    • parsePCLOutputOption

      private int parsePCLOutputOption(String[] args, int i) throws FOPException
      Throws:
      FOPException
    • parsePostscriptOutputOption

      private int parsePostscriptOutputOption(String[] args, int i) throws FOPException
      Throws:
      FOPException
    • parseTextOutputOption

      private int parseTextOutputOption(String[] args, int i) throws FOPException
      Throws:
      FOPException
    • parseSVGOutputOption

      private int parseSVGOutputOption(String[] args, int i) throws FOPException
      Throws:
      FOPException
    • parseAFPOutputOption

      private int parseAFPOutputOption(String[] args, int i) throws FOPException
      Throws:
      FOPException
    • parseFOOutputOption

      private int parseFOOutputOption(String[] args, int i) throws FOPException
      Throws:
      FOPException
    • parseCustomOutputOption

      private int parseCustomOutputOption(String[] args, int i) throws FOPException
      Throws:
      FOPException
    • parseUnknownOption

      private int parseUnknownOption(String[] args, int i) throws FOPException
      Throws:
      FOPException
    • parseAreaTreeOption

      private int parseAreaTreeOption(String[] args, int i) throws FOPException
      Throws:
      FOPException
    • parseIntermediateFormatOption

      private int parseIntermediateFormatOption(String[] args, int i) throws FOPException
      Throws:
      FOPException
    • parseAreaTreeInputOption

      private int parseAreaTreeInputOption(String[] args, int i) throws FOPException
      Throws:
      FOPException
    • parseIFInputOption

      private int parseIFInputOption(String[] args, int i) throws FOPException
      Throws:
      FOPException
    • parseImageInputOption

      private int parseImageInputOption(String[] args, int i) throws FOPException
      Throws:
      FOPException
    • getPDFEncryptionParams

      private PDFEncryptionParams getPDFEncryptionParams() throws FOPException
      Throws:
      FOPException
    • parsePDFOwnerPassword

      private int parsePDFOwnerPassword(String[] args, int i) throws FOPException
      Throws:
      FOPException
    • parsePDFUserPassword

      private int parsePDFUserPassword(String[] args, int i) throws FOPException
      Throws:
      FOPException
    • parsePDFProfile

      private int parsePDFProfile(String[] args, int i) throws FOPException
      Throws:
      FOPException
    • setOutputMode

      private void setOutputMode(String mime) throws FOPException
      Throws:
      FOPException
    • setInputFormat

      private void setInputFormat(int format) throws FOPException
      Throws:
      FOPException
    • checkSettings

      private void checkSettings() throws FOPException, FileNotFoundException
      checks whether all necessary information has been given in a consistent way
      Throws:
      FOPException
      FileNotFoundException
    • setUserConfig

      private void setUserConfig() throws FOPException, IOException
      Sets the user configuration.
      Throws:
      FOPException - if creating the user configuration fails
      IOException
    • getOutputFormat

      protected String getOutputFormat() throws FOPException
      Returns:
      the chosen output format (MIME type)
      Throws:
      FOPException - for invalid output formats
    • createInputHandler

      private InputHandler createInputHandler()
      Create an InputHandler object based on command-line parameters
      Returns:
      a new InputHandler instance
      Throws:
      IllegalArgumentException - if invalid/missing parameters
    • getFOUserAgent

      protected FOUserAgent getFOUserAgent()
      Get the FOUserAgent for this Command-Line run
      Returns:
      FOUserAgent instance
    • getFOFile

      public File getFOFile()
      Returns the XSL-FO file if set.
      Returns:
      the XSL-FO file, null if not set
    • getXMLFile

      public File getXMLFile()
      Returns the input XML file if set.
      Returns:
      the input XML file, null if not set
    • getXSLFile

      public File getXSLFile()
      Returns the stylesheet to be used for transformation to XSL-FO.
      Returns:
      stylesheet
    • getOutputFile

      public File getOutputFile()
      Returns the output file
      Returns:
      the output file
    • getUserConfigFile

      public File getUserConfigFile()
      Returns the user configuration file to be used.
      Returns:
      the userconfig.xml file
    • isCoarseAreaXml

      public Boolean isCoarseAreaXml()
      Indicates whether the XML renderer should generate coarse area XML
      Returns:
      true if coarse area XML is desired
    • isInputFromStdIn

      public boolean isInputFromStdIn()
      Indicates whether input comes from standard input (stdin).
      Returns:
      true if input comes from standard input (stdin)
    • isOutputToStdOut

      public boolean isOutputToStdOut()
      Indicates whether output is sent to standard output (stdout).
      Returns:
      true if output is sent to standard output (stdout)
    • getInputFile

      public File getInputFile()
      Returns the input file.
      Returns:
      either the fofile or the xmlfile
    • printVersion

      private static void printVersion()
    • printUsage

      public static void printUsage(PrintStream out)
      Shows the command line syntax including a summary of all available options and some examples.
      Parameters:
      out - the stream to which the message must be printed
    • printUsagePrintOutput

      private void printUsagePrintOutput()
      shows the options for print output
    • dumpConfiguration

      private void dumpConfiguration()
      Outputs all commandline settings
    • flushCache

      private void flushCache() throws FOPException
      Throws:
      FOPException