Closed briandominick closed 5 years ago
You should be able to use Asciidoctor PDF via the Asciidoctor.convert_file
with the following script:
require 'asciidoctor-pdf'
Asciidoctor.convert_file 'input.adoc', backend: 'pdf', safe: :safe
The only requirements are that:
Is that not working for you?
Sorry Dan I should have come by and closed this issue. I did first implemen a CLI invocation of asciidoctor-pdf. Whatever testing I was doing was getting me stuck, and it matched the experience of someone else I was talking to at the time, that somehow invoking the asciidoctor-pdf gem was inadequate. I knew that couldn't be true (and that you can't get to ever issue post here), so I tried again recently and now I'm properly calling asciidoctor-pdf as a gem. https://github.com/DocOps/liquidoc-gem/pull/54
I'm sorry I didn't come back here and update this post. I forgot I posted it!
No problem @briandominick. I'm very happy to hear you got it working!
I'm curious about one thing, though. What does require: "pdf"
do? I don't see a pdf.rb
file in the repository, and "pdf" is not the name of a gem. It looks like you are already requiring asciidoctor-pdf
at the top of the file, so I don't think you need that line unless I'm missing something.
Ah, if only I had you reviewing all of my PRs @mojavelinux! Or anyone, for that matter, but definitely you would be great, welcome anytime ;-) That looks vestigial from some attempt at something.
;)
If you need input, always feel free to @ me.
I've got a gem that calls
Asciidoctor.convert_file
and always setsrequire: "pdf"
, so whenbackend: pdf
it churns out a nice doc. This has worked pretty great, but after struggling to suppress the cover page on a PDF document I'm rendering, I was unable to make it work, even using the technique described in Issue #95. So I tested by directly building withasciidoctor-pdf
on the CLI, and it works like a charm.So should I be trying to get
Asciidoctor.convert_file
to behave like theasciidoctor-pdf
command? Maybe I'm missing a setting? Is there a way to call the Asciidoctor PDF from my Ruby script? Or do I have to switch to an explicit command-line invocation?