Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
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 |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Administrator
|
Amra, If Asciidoctor is not finding Asciidoctor PDF, then it is most likely a classpath issue. Things are a bit more complex in container and it depends on the environment. Perhaps you could start with a simple servlet and make sure that works first. Here's some information about running AsciidoctorJ on Wildfly. I'm not sure if that's what you are using, but you should get the idea of what you'd have to do. I know that AsciidoctorJ 1.6.0 is going to provide an OSGi bundle, so we're moving in the direction of making it more container friendly. Cheers, -Dan On Thu, Dec 24, 2015 at 2:04 AM, amraalic [via Asciidoctor :: Discussion] <[hidden email]> wrote: Hi all, ... [show rest of quote] Dan Allen | @mojavelinux | http://google.com/profiles/dan.j.allen |
Free forum by Nabble | Edit this page |