I attempted to convert my mybook.adoc
to mybook.pdf
using pandoc
, and got the following error.
$ pandoc -s mybook.adoc -t asciidoc -o mybook.pdf
pandoc: cannot produce pdf output with asciidoc writer
Is there another tool that I should use instead of or in concert with pandoc
?
How can I convert asciidoc to pdf?
AsciiDoc is a text document format that was explicitly designed with the needs of publishing in mind, both print and web. It supports all the structural elements necessary for writing notes, documentation, articles, books, ebooks, slideshows, web pages, technical manuals and blogs.
Click the Select a file button above or drag and drop a file into the drop zone. Select the document you want to convert to PDF. Watch Adobe Acrobat do its PDF conversion magic. Download your new PDF or sign in to share it.
Open the PDF Converter Settings panel from Start > Programs > AssistMyTeam PDF Converter for Windows. Alternatively, invoke it from the context menu of Windows Explorer. From the Settings panel, go to Auto PDF tab and check 'Enable Automation' option.
If you have Docker installed, you can use the AsciiDoctor Docker Image. Then you can use the image interactively or in batch mode as explained below:
Prerequisites
Install the Docker image:
$ docker pull asciidoctor/docker-asciidoctor
Create the pdf by executing the following command:
$ cd [directory to where my book.adoc is located]
$ docker run --rm -v $(pwd):/documents/ asciidoctor/docker-asciidoctor asciidoctor-pdf mybook.adoc
docker run
starts a Docker container--rm
cleanup - removes the Docker container after the command has been executed-v
mount a volume to the image$(pwd)
get the path to the current directory, e.g. the value of [directory to where my book.adoc is located]
abovedocuments
the name of the mounted volume in the running containerasciidoctor/docker-asciidoctor
the name of the Docker image that is used to create the Docker containerasciidoctor-pdf
the command that actually triggers the pdf generationmybook.adoc
the name of the AsciiDoc source file to generate the pdf fromSee also the docker run documentation
I now realize the ideal route from asciidoc to pdf is to first convert the asciidoc to docbook. This employs the intended sphere of asciidoc and a docbook->pdf converter using each in its separate area of concern.
Furthermore, instead of pandoc
I have found that when mathematical formulas are included, it was easier to use dblatex
for docbook->pdf conversion. Thus my conversion pipeline is the following:
asciidoc -> asciidoctor -> docbook -> dblatex -> pdf
A sample make file:
make: my.adoc
asciidoc -b docbook my.adoc
dblatex my.xml
This discussion page suggests that asciidoc is primarily designed to compile to docbook.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With