Closed jonathanday930 closed 5 years ago
Hi Jonathan,
Do you have a sample project to clone?
No, but I got it to work!
I used to convert files with this code:
public static void main(String[] args) {
Asciidoctor asciidoct= Asciidoctor.Factory.create();
Map<String, Object> attributes =new HashMap<>();
attributes.put("backend", "pdf");
attributes.put("toc", "left");
Map<String, Object> options = options().safe(SafeMode.SAFE).asMap();
options.put("attributes", attributes);
options.put("in_place", true);
String[] res = asciidoct.convertDirectory(
new AsciiDocDirectoryWalker("C:\\Users\\Intern1\\documentation\\asciidoctor"),
options);
System.out.println("done");
}
but now I can convert PDFs by using this code:
public static void main(String[] args) {
Asciidoctor asciidoct= Asciidoctor.Factory.create();
Options options = new Options();
options.setBackend("html");
options.setSafe(SafeMode.SAFE);
String[] res = asciidoct.convertDirectory(
new AsciiDocDirectoryWalker("C:\\Users\\Intern1\\documentation\\asciidoctor"),
options);
System.out.println("done");
}
}
It looks like there is an error with options somewhere when I configured the options manually. Using the first implementation, I was able to generate HTML but not pdfs. In the second, I can generate both.
It looks a bit strange that in the upper example you're setting the attribute backend
to pdf
while it must be the option like you did in the second example.
Can you please try using the option?
Looks like this is solved and can be closed.
Here is my gradle.build script:
Whenever I run convertDirectory, and have the backend set to html, it works. However, when I set backend to pdf, I get this:
Anyone have any ideas on what this could be? It looks like asciidoctorJ isnt finding asciidoctorJ-pdf, but I dont know why.