Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
33 posts
|
Do we ever see a time when we will be able to gen PDF's using a ruby gem named something like asciidoctor-pdf ?
looking at the asciidoctorJ notes from https://github.com/asciidoctor/asciidoctorj there is no jar, etc download for it only shows as: org.asciidoctor asciidoctorj-pdf 1.5.0-alpha.6 so no joy there yet |
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
2681 posts
|
Jim, I'm not sure I understand your question. Asciidoctor PDF has been available for some time to serve this purpose and we've even realized AsciidoctorJ PDF so you can use it from Java without much hassle. You can see an example of it in use in the Maven plugin examples. All you need to do is add org.asciidoctor:asciidoctorj-pdf:1.5.0-alpha.6 to the classpath and set the backend to "pdf" to use it. https://github.com/asciidoctor/asciidoctor-maven-examples/blob/master/asciidoctor-pdf-example/pom.xml#L34 Cheers, On Mon, Jan 26, 2015 at 3:20 PM, jnorthr [via Asciidoctor :: Discussion] <[hidden email]> wrote: Do we ever see a time when we will be able to gen PDF's using a ruby gem named something like asciidoctor-pdf ? -- Dan Allen | http://google.com/profiles/dan.j.allen |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
126 posts
|
In reply to this post by jnorthr
This is currently working very well. It uses Ruby:
How to Convert AsciiDoc to PDF with Asciidoctor
- Ted
@TedAtCIS
|
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
11 posts
|
How do you use asciidoctor-pdf using the ruby API?
With the asciidoctor command I can run: asciidoctor -b pdf -r asciidoctor-pdf file.adoc With the API I am trying to set: adoc_options[:attributes]["backend"] = 'pdf' adoc_options[:requires] = ['asciidoctor-pdf'] doc = Asciidoctor.load_file options[:file], adoc_options But I get the following error: /home/david/.rvm/gems/ruby-2.2.0/gems/asciidoctor-1.5.2/lib/asciidoctor/document.rb:1016:in `convert': asciidoctor: FAILED: missing converter for backend 'pdf'. Processing aborted. (RuntimeError) I get the same error when trying to set "requires" pointing to my local copy of asciidoctor-pdf. Any ideas? The asciidoctor-pdf gem is installed and properly used when calling the script from the command line. Thanks, |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
70 posts
|
Just tried with
asciidoctor 1.5.2 asciidoctor-pdf 1.5.0.alpha.6 on JRuby 1.7.13 on Win7 and the following script worked fine for me: require 'asciidoctor' require 'asciidoctor-pdf' Asciidoctor.convert_file 'test.ad', :backend => 'pdf' Could you check if that works for you as well? Best regards, Robert |
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
2681 posts
|
As Robert pointed out, you need to require the library explicitly when using the API. The required option is only processed by the cli (asciidoctor command), not in the API itself. You get an error because asciidoctor-pdf was never required. Cheers, -Dan On Tue, Mar 31, 2015 at 9:05 AM, Robert.Panzer [via Asciidoctor :: Discussion] <[hidden email]> wrote: Just tried with ... [show rest of quote] Dan Allen | http://google.com/profiles/dan.j.allen |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
11 posts
|
Thanks guys, I am almost there: require 'asciidoctor' require 'asciidoctor-pdf' adoc_options[:attributes]["backend"] = 'pdf' doc = Asciidoctor.load_file options[:file], adoc_options Check_document.check_broken_references(doc) File.open("test.html", "w+") do |file| file.puts doc.render end I need the doc object for some processing, like checking broken references, so using convert_file doesn't work for me. The code above works for html but when the backend is pdf I get a file with: less test.html #<Asciidoctor::Pdf::Converter:0x0000000190dbd8> How do I render from the doc object into the pdf file? I also tried this without luck. doc.render(:to_file => "test2.pdf") Thanks, --David On Tue, Mar 31, 2015 at 7:16 AM, mojavelinux [via Asciidoctor :: Discussion] <[hidden email]> wrote:
... [show rest of quote] |
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
2681 posts
|
On Tue, Mar 31, 2015 at 7:13 PM, davidgamba [via Asciidoctor :: Discussion] <[hidden email]> wrote:
You need to use render_file, then it should sort out the extension properly. doc.render_file target You can see where this is done in Asciidoctor PDF internals. That file holds the key info you probably need :) |
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
2681 posts
|
In reply to this post by davidgamba
Note that render_file is a Prawn API, not an Asciidoctor API. The converter is both a Prawn Document and an Asciidoctor Converter object. -Dan On Tue, Mar 31, 2015 at 8:22 PM, Dan Allen <[hidden email]> wrote:
... [show rest of quote] Dan Allen | http://google.com/profiles/dan.j.allen |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
11 posts
|
Thanks, I got it by running by using: if options[:pdf] puts doc.convert.render_file output_file else File.open(output_file, "w+") do |file| file.puts doc.render end end As you can see, I had to use doc.convert to be able to access the pdf_doc methods. Thanks for your help! --David On Tue, Mar 31, 2015 at 12:23 PM, mojavelinux [via Asciidoctor :: Discussion] <[hidden email]> wrote:
... [show rest of quote] |
Free forum by Nabble | Edit this page |