Login  Register

Re: Asciidoctor YAML style file for PDF and maven

Posted by mojavelinux on Oct 15, 2015; 10:35pm
URL: https://discuss.asciidoctor.org/Asciidoctor-YAML-style-file-for-PDF-and-maven-tp3849p3857.html


On Thu, Oct 15, 2015 at 1:48 PM, Jeremie Bresson [via Asciidoctor :: Discussion] <[hidden email]> wrote:
1/ I did not manage to have an appropriate background_image on the title_page (this is my principal motivation for this approach).

Aha! I figured out what the problem is. AsciidoctorJ PDF bundles Prawn 1.3.0. In Prawn 1.3.0, the method needed to add a background image to a page was removed. It was then restored in Prawn 2. AsciidoctorJ PDF ships with Prawn 1.3.0, so this functionality is temporarily unavailable. AsciidoctorJ can't yet ship with Prawn 2 because Prawn 2 depends on Ruby 2, which means using JRuby 9.0.0.0. Since we hadn't made that jump yet, the current release of the toolchain is stuck between a rock and a hardplace. (Prawn put the JRuby community in a tight spot with their decision to drop Ruby 1.9, in my opinion).

Suffice to say, background images and colors aren't available when using AsciidoctorJ PDF right now. They will work as soon as we bundle Prawn 2 in AsciidoctorJ PDF (or you decide to temporarily use external gems with JRuby 9.0.0.0, which is tricky but possible).

Here's how to work around it:

$ rvm use jruby9k@maven-build --create
   gem install asciidoctor-pdf --pre
   gem install rouge

In the configuration for the Asciidoctor Maven plugin in your pom.xml:

1. Specify jruby-complete as a dependency using version 9.0.0.0 (or whatever 9k version you want).
2. Set the gemPaths configuration property to resolve to a local GEM_HOME

<gemPath>${env.GEM_HOME}</gemPath>

It should use the locally installed AsciidoctorJ PDF and Prawn 2, which have the hooks needed to add the background image.

Long story short, you have the configuration right. And will start working as soon as the right upgrades happen :)

Cheers,

-Dan


--
Dan Allen | @mojavelinux | http://google.com/profiles/dan.j.allen