"fop" Command in fop-0.20.5-bin.zip

Q

What Is the "fop" command in fop-0.20.5-bin.zip? Can I use it to generate PDF files?

✍: FYIcenter.com

A

"fop" command is the command line tool that allows you to run FOP 0.20.5 as a standalone application. It reads a XSL-FO file and generates a PDF file by default.

"fop" command is actually system command script. The Windows version, \local\fop-0.20.5\fop.bat, is provided below:

@ECHO OFF

rem %~dp0 is the expanded pathname of the current script under NT
set LOCAL_FOP_HOME=
if "%OS%"=="Windows_NT" set LOCAL_FOP_HOME=%~dp0

set LIBDIR=%LOCAL_FOP_HOME%lib
set LOCALCLASSPATH=%LOCAL_FOP_HOME%build\fop.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\xml-apis.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\xercesImpl-2.2.1.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\xalan-2.4.1.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\batik.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\avalon-framework-cvs-20020806.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\jimi-1.0.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\jai_core.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\jai_codec.jar
java -cp "%LOCALCLASSPATH%" org.apache.fop.apps.Fop %1 %2 %3 %4 %5 %6 %7 %8

"fop" command requires that the environment variable JAVA_HOME be set to a path pointing to the appropriate Java installation on your system. See the session below on how to use the "fop" command:

\fyicenter>cd \local\fop-0.20.5

\local\fop-0.20.5>echo %java_home%
   \Program Files\Java\jdk1.8.0_45\

\local\fop-0.20.5>fop

USAGE
Fop [options] [-fo|-xml] infile [-xsl file] [-awt|-pdf|-mif|-pcl
|-ps|-txt|-at|-print] <outfile>

[OPTIONS]
  -d             debug mode
  -x             dump configuration settings
  -q             quiet mode
  -c cfg.xml     use additional configuration file cfg.xml
  -l lang        the language to use for user information
  -s             (-at output) omit tree below block areas
  -txt.encoding  (-txt output encoding use the encoding for the output file.
                 The encoding must be a valid java encoding.
  -o [password]  pdf file will be encrypted with option owner password
  -u [password]  pdf file will be encrypted with option user password
  -noprint       pdf file will be encrypted without printing permission
  -nocopy        pdf file will be encrypted without copy content permission
  -noedit        pdf file will be encrypted without edit content permission
  -noannotations pdf file will be encrypted without edit annotation 
                 permission

[INPUT]
  infile            xsl:fo input file (the same as the next)
  -fo  infile       xsl:fo input file
  -xml infile       xml input file, must be used together with -xsl
  -xsl stylesheet   xslt stylesheet

[OUTPUT]
  outfile           input will be rendered as pdf file into outfile
  -pdf outfile      input will be rendered as pdf file (outfile req'd)
  -awt              input will be displayed on screen
  -mif outfile      input will be rendered as mif file (outfile req'd)
  -pcl outfile      input will be rendered as pcl file (outfile req'd)
  -ps outfile       input will be rendered as PostScript file (outfile req'd)
  -txt outfile      input will be rendered as text file (outfile req'd)
  -svg outfile      input will be rendered as an svg slides file 
                    (outfile req'd)
  -at outfile       representation of area tree as XML (outfile req'd)
  -print            input file will be rendered and sent to the printer
                    see print specific options with "-print help"

[Examples]
  Fop foo.fo foo.pdf
  Fop -fo foo.fo -pdf foo.pdf (does the same as the previous line)
  Fop -xsl foo.xsl -xml foo.xml -pdf foo.pdf
  Fop foo.fo -mif foo.mif
  Fop foo.fo -print or Fop -print foo.fo
  Fop foo.fo -awt

[ERROR] No input file specified

 

⇒ "xalan" Command in fop-0.20.5-bin.zip

⇐ What Is fop.jar 0.20.5

⇑ Download and Installing of FOP Older Versions

⇑⇑ FAQ for FOP (Formatting Object Processor)

2016-02-22, 2318👍, 0💬