Hi all,
I have created a web app in Vaadin that uses and Asciidoctor features for converting .adoc files to .pdf.
The app run on one laptop and I needed it to build on the other one, too.
In the addition, for few days I have been facing the error of missing converter back-end for 'pdf'.
I have already included asciidoctorj-pdf-1.5.0-alpha.9.jar and asciidoctorj-pdf-1.5.0-alpha.9.jar and all other necessary .jar files that I had added on the previous computer.
Bellow you can find the code and the exception:
fileName = DocumentName.getName();
try{
File file = new File(fileName + ".adoc");
if (!file.exists()) {
file.createNewFile();
}
fw = new FileWriter(file.getAbsoluteFile());
bw = new BufferedWriter(fw);
try {
printSelectedElementsInDocument();
}
catch (IOException e)
{
e.printStackTrace();
}
bw.close();
Asciidoctor asciidoctor = Asciidoctor.Factory.create();
HashMap<String, Object> options = new HashMap<String, Object>();
options.put("backend", "pdf");
options.put("in_place", true);
asciidoctor.convertFile(file,options);
Notification.show("Now, you can download the document.");
try{
Resource resource = new FileResource(new File("/home/amra/Documents/eclipse/" +fileName+ ".pdf"));
FileDownloader fileDownloader = new FileDownloader(resource);
fileDownloader.extend(MasterBrochureTab.getDownloadBrochureButton());
}
catch(Exception e)
{
Notification.show("You need to generate a brochure, and then download it.");
}
}
catch (IOException e) {
e.printStackTrace();
}
Asciidoctor asciidoctor = Asciidoctor.Factory.create();
HashMap<String, Object> options = new HashMap<String, Object>();
options.put("backend", "pdf");
options.put("in_place", true);
asciidoctor.convertFile(file,options);
Notification.show("Now, you can download the document.");
try{
Resource resource = new FileResource(new File( path +fileName+ ".pdf"));
FileDownloader fileDownloader = new FileDownloader(resource);
fileDownloader.extend(MasterBrochureTab.getDownloadBrochureButton());
}
catch(Exception e)
{
Notification.show("You need to generate a brochure, and then download it.");
}
}
catch (IOException e) {
e.printStackTrace();
}
The exception is thrown in asciidoctor.convertFile(file,options); line.
org.jruby.exceptions.RaiseException: (RuntimeError) asciidoctor: FAILED: missing converter for backend 'pdf'. Processing aborted.
at RUBY.convert(/home/amra/Documents/Diplomski/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Proba/WEB-INF/lib/asciidoctorj-1.5.2.jar!/gems/asciidoctor-1.5.2/lib/asciidoctor/document.rb:1016)
at RUBY.convert(/home/amra/Documents/Diplomski/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Proba/WEB-INF/lib/asciidoctorj-1.5.2.jar!/gems/asciidoctor-1.5.2/lib/asciidoctor.rb:1499)
at RUBY.convert_file(/home/amra/Documents/Diplomski/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Proba/WEB-INF/lib/asciidoctorj-1.5.2.jar!/gems/asciidoctor-1.5.2/lib/asciidoctor.rb:1562)
at RUBY.convertFile(<script>:68)
at org.jruby.gen.InterfaceImpl2102387735.convertFile(org/jruby/gen/InterfaceImpl2102387735.gen:13)
PS I had the same exception few weeks ago, but then I have been using attributes to set up the back-end, and you advised me to use options which solved the error. This time I cannot find the root cause.
I appreciate your help.
Regards,
Amra
If you reply to this email, your message will be added to the discussion below:http://discuss.asciidoctor.org/Missing-converter-backend-for-pdf-tp4127.htmlTo start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML
| Free forum by Nabble | Edit this page |