Re: PDF's from asciidoctor-pdf ruby gem ?

Posted by davidgamba on
URL: https://discuss.asciidoctor.org/PDF-s-from-asciidoctor-pdf-ruby-gem-tp2715p2882.html

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,