Login  Register

Re: Adding Document Control to title page

Posted by lorrden on May 01, 2019; 12:21pm
URL: https://discuss.asciidoctor.org/Adding-Document-Control-to-title-page-tp6841p6879.html

I did something similar with an asciidoctor pdf extension (there is some more info at see https://github.com/asciidoctor/asciidoctor-pdf/issues/337).

Then I overrode the layout_title_page method:

def layout_title_page doc
    super
    canvas do
        bounding_box [50,bounds.top-20], :width => bounds.width - 100, :height => 100 do
            theme_font :header do
                move_cursor_to bounds.top
                layout_prose "Document number: " + (doc.attr 'document-number') +
                             "Document owner: " + (doc.attr 'document-owner'), {margin_bottom: 0, margin_top: 0, normalize: false}
            end
        end
    end
end

The use of canvas enables the placement of stuff in the header and footer area of the title page (margins defined in the theme file), otherwise you end up inside the main body of the title page. If you want it in the main body, you can omit the canvas and just place it in a bounding box directly and it will be relative to the main body of the title page.