I am busy installing asciidoctor-fopub on a Windows 10 machine. I have both JRE version 1.7.0_40 and 1.8.0_171 installed.
I created the sample.xml file following the instructions from the github page:
I have the JAVA_HOME environment variable set to "C:\Program Files (x86)\Java\jre7". If I now run:
fopub sample.xmlthen the output is:
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/fop/cli/InputHandler : Unsupported major.minor version 52.0
This made me think that my Java version 1.7 was not supported. So I installed 1.8 and set the JAVA_HOME environment variable to "C:\Program Files (x86)\Java\jre1.8.0_171". If I now run:
fopub sample.xmlthen the output is:
USAGE fop [options] [-fo|-xml] infile [-xsl file] [-awt|-pdf|-mif|-rtf|-tiff|-png|-pcl|-ps|-txt|-at [mime]|-print] <outfile> [OPTIONS] -version print FOP version and exit -x dump configuration settings -c cfg.xml use additional configuration file cfg.xml -l lang the language to use for user information -nocs disable complex script features -r relaxed/less strict validation (where available) -dpi xxx target resolution in dots per inch (dpi) where xxx is a number -s for area tree XML, down to block areas only -v run in verbose mode (currently simply print FOP version and continue) -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 -nofillinforms PDF file will be encrypted without fill in interactive form fields permission -noaccesscontent PDF file will be encrypted without extract text and graphics permission -noassembledoc PDF file will be encrypted without assemble the document permission -noprinthq PDF file will be encrypted without print high quality permission -a enables accessibility features (Tagged PDF etc., default off) -pdfprofile prof PDF file will be generated with the specified profile (Examples for prof: PDF/A-1b or PDF/X-3:2003) -conserve enable memory-conservation policy (trades memory-consumption for disk I/O) (Note: currently only influences whether the area tree is serialized.) -cache specifies a file/directory path location for the font cache file -flush flushes the current font cache file [INPUT] infile xsl:fo input file (the same as the next) (use '-' for infile to pipe input from stdin) -fo infile xsl:fo input file -xml infile xml input file, must be used together with -xsl -atin infile area tree input file -ifin infile intermediate format input file -imagein infile image input file (piping through stdin not supported) -xsl stylesheet xslt stylesheet -param name value <value> to use for parameter <name> in xslt stylesheet (repeat '-param name value' for each parameter) -catalog use catalog resolver for input XML and XSLT files [OUTPUT] outfile input will be rendered as PDF into outfile (use '-' for outfile to pipe output to stdout) -pdf outfile input will be rendered as PDF (outfile req'd) -pdfa1b outfile input will be rendered as PDF/A-1b compliant PDF (outfile req'd, same as "-pdf outfile -pdfprofile PDF/A-1b") -awt input will be displayed on screen -rtf outfile input will be rendered as RTF (outfile req'd) -pcl outfile input will be rendered as PCL (outfile req'd) -ps outfile input will be rendered as PostScript (outfile req'd) -afp outfile input will be rendered as AFP (outfile req'd) -tiff outfile input will be rendered as TIFF (outfile req'd) -png outfile input will be rendered as PNG (outfile req'd) -txt outfile input will be rendered as plain text (outfile req'd) -at [mime] out representation of area tree as XML (outfile req'd) specify optional mime output to allow the AT to be converted to final format later -if [mime] out representation of document in intermediate format XML (outfile req'd) specify optional mime output to allow the IF to be converted to final format later -print input file will be rendered and sent to the printer see options with "-print help" -out mime outfile input will be rendered using the given MIME type (outfile req'd) Example: "-out application/pdf D:\out.pdf" (Tip: "-out list" prints the list of supported MIME types and exits) -svg outfile input will be rendered as an SVG slides file (outfile req'd) Experimental feature - requires additional fop-sandbox.jar. -foout outfile input will only be XSL transformed. The intermediate XSL-FO file is saved and no rendering is performed. (Only available if you use -xml and -xsl parameters) [Examples] fop foo.fo foo.pdf fop -fo foo.fo -pdf foo.pdf (does the same as the previous line) fop -xml foo.xml -xsl foo.xsl -pdf foo.pdf fop -xml foo.xml -xsl foo.xsl -foout foo.fo fop -xml - -xsl foo.xsl -pdf - fop foo.fo -mif foo.mif fop foo.fo -rtf foo.rtf fop foo.fo -print fop foo.fo -awt Jun 15, 2018 4:05:26 PM org.apache.fop.cli.Main startFOP SEVERE: Exception org.apache.fop.apps.FOPException: Don't know what to do with - at org.apache.fop.cli.CommandLineOptions.parseUnknownOption(CommandLineOptions.java:737) at org.apache.fop.cli.CommandLineOptions.parseOptions(CommandLineOptions.java:399) at org.apache.fop.cli.CommandLineOptions.parse(CommandLineOptions.java:167) at org.apache.fop.cli.Main.startFOP(Main.java:169) at org.apache.fop.cli.Main.main(Main.java:217)
Any thoughts of what I am doing wrong?
asciidoctor-fopub is working fine in my Linux environment with JRE 1.8.0_171.
A big "THANK YOU" to all those working on making asciidoctor such a great set of tools!
Marc, not being an expert I do however have one idea, which I learned by hard experience: Have you installed the JDK, or just the JRE?
I raise this because everywhere in your description you mention JRE, but not JDK: My experience is that JRE by itself will not suffice with fopub, you must install JDK.
(which Dan does specify--but still, I learned the hard way: https://github.com/asciidoctor/asciidoctor-fopub)
Oops. It may be a case of RTFM on my behalf. I will try again.
BTW: I am still to try out your code for the chapters in fopub. I got very busy around the time that we were messaging about that so it slipped.
...well I don't know what to do anymore. I downloaded and installed Java JDK, the latest version 10.0.1 (64-bit) from the Oracle website. I installed that, made sure that JAVA_HOME was set to C:\Program Files\java\jdk_10.0.1 (or whatever the exact name was). I made sure that I added the "bin" directory to the path. I could run "java -version" as well as "javac -version", but I am getting the same results as before.
I then thought that perhaps the latest JDK was too new, so I downloaded JDK 8u172 in 32-bit flavour. Installed that, did the whole environment variable thing and I am still getting the same issue as before.
What I did notice is that the example output on the fopub Github site shows this:
$ java -version java version "1.7.0_25" OpenJDK Runtime Environment (fedora-126.96.36.199.fc17-x86_64) OpenJDK 64-Bit Server VM (build 23.7-b01, mixed mode)
...whereas my Windows output is:
C:\> java -version java version "1.8.0_172" Java(TM) SE Runtime Environment (build 1.8.0_172-b11) Java HotSpot(TM) Client VM (build 25.172-b11, mixed mode, sharing)
...having said that, the output on my Linux machine is:
$ java -version java version "1.8.0_171" Java(TM) SE Runtime Environment (build 1.8.0_171-b11) Java HotSpot(TM) 64-Bit Server VM (build 25.171-b11, mixed mode)
So it would seem that on Windows I am somehow running a "Client VM" but on Linux I am running a "Server VM", like in the Linux example output from the Github page.
I went back to the Oracle site but couldn't find an option to download a "Server VM".
Any suggestions are welcome.
On my Windows 10 machine, I'm getting the same result as you from
java -versionSo, I've no doubts now you've got everything in place, that you need.
However, my environment variables are set up differently than yours for Java:
-- I don't even have a JAVA_HOME environment variable
-- I do have the following two paths within the string of my PATH environment variable:
C:\Program Files (x86)\Common Files\Oracle\Java\javapath
It would be interesting to know what Java-paths you've got in your own PATH variable...
Also--to my surprise--I have no CLASSPATH variable !!
However, if you do have one, its contents would be interesting as well.
After finding so many weirdnesses in my environment variables, I decided to make sure my fopub was still working...
However, I got it working again!
by 1) adding this bit to my PATH:
%JAVA_HOME%\binand 2) adding these environment variables:
JAVA_HOME : C:\Program Files (x86)\Java\jdk1.8.0_144
JDK_HOME : %JAVA_HOME%
CLASSPATH : .;%JAVA_HOME%\lib;%JAVA_HOME%\jre\lib
So, I am constrained to ask: does your set of environment variables include stuff sorta like that? Especially, is CLASSPATH present and looking correct?
If all that's OK, then we must focus on the most interesting bit you got in the output:
Jun 15, 2018 4:05:26 PM org.apache.fop.cli.Main startFOP SEVERE: Exception org.apache.fop.apps.FOPException: Don't know what to do with - at org.apache.fop.cli.CommandLineOptions.parseUnknownOption(CommandLineOptions.java:737) at org.apache.fop.cli.CommandLineOptions.parseOptions(CommandLineOptions.java:399) at org.apache.fop.cli.CommandLineOptions.parse(CommandLineOptions.java:167) at org.apache.fop.cli.Main.startFOP(Main.java:169) at org.apache.fop.cli.Main.main(Main.java:217)
Weirdly, this seems to say that when your fopub script calls FOP (which Dan says happens at the end), its getting a command-line-parsing error, from parsing an unknown option; specifically,
Don't know what to do with -
That's one of those errors that's so weird you suspect it's not the real problem. Yet, it MIGHT be... but it would entail that somehow your fopub.bat file got corrupted--no?
Thank you very much for all the hand-holding. I have updated my environment variables to mimic yours, but am still having the same issue.
I then decided to create a really dumbed-down document; I wanted to see if perhaps something in my source document was causing issues. I created a new file called "marc.adoc" with just this as the contents:
== Title This is a piece of text.
I could successfully create a PDF file from this using fopub. Then I looked at your comment to focus on:
Don't know what to do with -
My file names typically have spaces in them as well as a dash... I renamed my file to "marc - 0.1.adoc" and tried again. You should know that I am typically calling fopub programatically, rather than directly from the command line. This happened:
C:\tmp>fopub "marc - 0.1.xml" - was unexpected at this time.
It would seem that fopub does not properly recognise the file name with spaces in it. Doing more investigation, I found that when I do things programatically the file name with spaces gets passed properly. I also found that I am referencing a docbook-xls directory (with the -t option) that does not exist. So that doesn't help either. The error message I am getting now is in relation to the fact that the docbook-xsl directory does not exist. However it does not explain the message:
Don't know what to do with -
I have been trying to re-create that error message, but I cannot anymore. Perhaps that error got resolved by me updating my environment variables.
In any case, I have a way forward. Thank you again for your kind assistance!
For future reference--and because I don't know where else to report this--it seems to be a Windows 10 bug, rather than a fopub.bat bug:
Line 30 of the current fopub.bat file is where the problem occurs:
if "%1" == "-h" GOTO :usageThe quote marks around "%1" (the variable which holds the filepath you gave as the first parameter) are the standard Windows batch-file way of keeping in one piece a variable value that has spaces in it (a space would otherwise indicate the end of the variable's string-value).
But it is running exactly the same as when one omits the quote marks.:
if %1 == "-h" GOTO :usageI'm clueless why the quotes are not working... and I looked for other ways to fulfill that quote-functionality, but found none...
I lied--there seems to be a fix. I'll try to do a pull request for this soon on asciidoctor-fopub...
(I was misreading the signs: all you have to do, it turns out, is save the parameter to a different variable, in a way that removes the quote marks, if any, that were surrounding the parameter:
set first=%~1Then you just use that variable from then on, in place of %1.)
I've submitted that pull request; it's at https://github.com/asciidoctor/asciidoctor-fopub/pull/84.
I tested the code with a source file named
sample - 3.xml
The (few, minor) code-changes are visible at https://github.com/asciidoctor/asciidoctor-fopub/pull/84/files
(This 'fopub.bat' file is the one in the main, 'asciidoctor-fopub' folder.)
|Free forum by Nabble||Edit this page|