Re: Running Header for PDF

Posted by mojavelinux on
URL: https://discuss.asciidoctor.org/Running-Header-for-PDF-tp3505p3508.html

At the moment, you need to set the pagenums attribute on the document for the running header/footer to be added. This is related to https://github.com/asciidoctor/asciidoctor-pdf/issues/205

Cheers,

-Dan

On Thu, Jul 16, 2015 at 9:03 AM, karfunkel [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Hi everyone,

I am a bit confused as I am trying to create a running header and footer.
I am using asciidoctorj with a gradle build.

This is the gradle build file:

buildscript {
    repositories {
        jcenter()
    }

    dependencies {
        classpath 'org.asciidoctor:asciidoctor-gradle-plugin:1.5.2'
        classpath 'com.github.jruby-gradle:jruby-gradle-plugin:0.1.5'
        classpath 'org.ysb33r.gradle:vfs-gradle-plugin:1.0-beta1'
        classpath 'org.asciidoctor:asciidoctorj-pdf:1.5.0-alpha.8'
        classpath 'com.github.ben-manes:gradle-versions-plugin:0.8'
        classpath 'com.bluepapa32:gradle-watch-plugin:0.1.5'
    }
}

apply plugin: 'com.github.jruby-gradle.base'
apply plugin: 'org.ysb33r.vfs'
apply plugin: 'org.asciidoctor.convert'
apply plugin: 'com.github.ben-manes.versions'
apply plugin: 'com.bluepapa32.watch'

group = 'de.huk.jenkins.handbook'
version = '1.0.0-SNAPSHOT'

repositories {
    jcenter()
}

dependencies {
    gems 'rubygems:asciidoctor-diagram:1.3.0.preview.4'
    gems 'rubygems:slim:2.1.0'
    gems 'rubygems:thread_safe:0.3.4'
}

asciidoctor {
    options doctype: 'book'

    backends = ['html5', 'pdf']

    dependsOn jrubyPrepareGems
    gemPath = jrubyPrepareGems.outputDir
    requires = ['asciidoctor-diagram']

    attributes 'source-highlighter': 'coderay',
            'coderay-linenums-mode': 'table',
            'imagesdir': './images',
            toc: 'left',
            icon: 'font',
            linkattrs: true,
            encoding: 'utf-8',
            now: new Date().format('dd.MM.yyyy'),
            'pdf-stylesdir': './theme',
            'pdf-fontsdir': './fonts',
            'pdf-style': 'huk'

    sources {
        include 'Betriebshandbuch.adoc'
        include 'Nutzerhandbuch.adoc'
        include 'Folder.adoc'
        include 'Plugins.adoc'
        include 'Tools.adoc'
    }

    resources {
        from(sourceDir) {
            include 'images/**'
        }
    }
}

watch {
    asciidoc {
        files fileTree(dir: 'src/docs/asciidoc', include: '**/*.adoc')
        tasks 'asciidoctor'
    }
}

The used theme file is the default one modified for the header and footer areas like this:

footer:
  font_size: $base_font_size_small
  font_color: $base_font_color
  border_color: dddddd
  border_width: 0.25
  height: $base_line_height_length * 2.5
  padding: [$base_line_height_length / 2, 1, 0, 1]
  valign: top
  recto_content:
    right: '{page-number}'
  verso_content:
    left: '{page-number}'
header:
  font_size: $base_font_size_small
  font_color: $base_font_color
  border_color: dddddd
  border_width: 0.25
  border_style: solid
  height: $base_line_height_length * 2.5 * 4
  padding: [$base_line_height_length / 2, 1, 0, 1]
  valign: top
  recto_content:
    right: 'Seite {page-number} | Stand {now} | | {document-title}'
  verso_content:
    right: 'Seite {page-number} | Stand {now} | | {document-title}'

But when I create the document I neither see a header nor a footer - even with the default I should have a footer with page numbers as far as I understood.

What am I doing wrong?

Thanks in advance,
Sascha


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Running-Header-for-PDF-tp3505.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--