Unable to use the library
I am suing this library to convert markdown to html.
<dependency>
<groupId>org.bitbucket.leito</groupId>
<artifactId>universal-document-converter</artifactId>
<version>1.1.0</version>
</dependency>
However, when I run the following lines ...
new DocumentConverter()
.fromFile(new File("/Users/myuser/MANUAL.txt"), InputFormat.MARKDOWN)
.toFile(new File("/Users/myuser/MANUAL.HTML"), OutputFormat.HTML).addOption("-o") // optional
Eclipse throw the following Exception:
Cannot run program "pandoc": error=2, No such file or directory
I have installed pandoc using homebrew, I am able to run pandoc from the Terminal (command line) and get exact results but not from Eclipse. I see that pandoc is installed at /usr/local/bin/pandoc on my local machine.
Anyone using this library complained this before? How do I solve this problem?
Comments (4)
-
reporter -
I think that means that pandoc can not find your file:
Example:
pandoc: asdfasdf.txt: openBinaryFile: does not exist (No such file or directory)
-
I had same problem under linux with pandoc on the path. Changing
String.format("\"%s\" \"%s\" --from=%s --to=%s %s --output=\"%s\"", settings.getPandocExec(), fromFile.getAbsoluteFile(), fromFormat, toFormat, extraOptions, toFile.getAbsoluteFile());
into
String.format("%s \"%s\" --from=%s --to=%s %s --output=\"%s\"", settings.getPandocExec(), fromFile.getAbsoluteFile(), fromFormat, toFormat, extraOptions, toFile.getAbsoluteFile());
in the DocumentConverter was the solution.
-
Had the same problem, so I abandoned the library and instead just invoking
pandoc
directly.Note that Java 7 now offers a
ProcessBuilder
that allows you to specify the arguments one by one. An added benefit is that you can easily redirect thepandoc
output tostdout
/stderr
:ProcessBuilder processBuilder = new ProcessBuilder("pandoc", "--from", "html", "--to", "asciidoc", "--output", adocFilePath, htmlFile.getAbsolutePath()); processBuilder.redirectOutput(INHERIT); processBuilder.redirectError(INHERIT);
- Log in to comment
May not be an issue with the library but I am unable to use it, appreciate your help.