Re: PDF's from asciidoctor-pdf ruby gem ?
Posted by
davidgamba on
URL: https://discuss.asciidoctor.org/PDF-s-from-asciidoctor-pdf-ruby-gem-tp2715p2896.html
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