ggrossetie / asciidoctor-web-pdf

Convert AsciiDoc documents to PDF using web technologies
https://asciidoctor.org
MIT License
445 stars 92 forks source link

Generating two cover pages? #554

Closed ghost closed 2 years ago

ghost commented 2 years ago

I created a stylesheet including this;

@page :first {
  background-size: large;
  background-image: url("../images/logo.png");
  background-repeat: no-repeat;
  background-position: top;
}

#cover > h1 {
  color: auto;
  margin-top: 1cm;
  font-size: 4rem;
  text-align: center;

}

and found it generated a pretty darn decent cover page in my final pdf. However, after adding the following for footers:

.footer {
  width: 100%;
  position: running(runningFooter)
}

@page :right {
    @bottom-left {
        content: element(runningFooter);
        margin: 1cm 0.5cm 1cm 0.5cm;
  }     
}
@page :left {
    @bottom-right {
        content: element(runningFooter);
        margin: 1cm 0.5cm 1cm 0.5cm;
    } 
}

I found that the title would be pushed off the cover page. This was supported by a docinfo file for the running footer

So I added the following to my docinfo, so the cover could be generated:

<div id="cover" class="title-page front-matter">
  <h1> {doctitle} {version} </h1>
</div>

with the {} items being taken from this .adoc header:

= Document Title is here
:doctitle: Document Title is here
:documentcode: DOC-COD
:docinfo: shared
:doctype: book
:encoding: utf-8
:lang: en
:toc: left
:toclevels: 3
:numbered:
:experimental:
:xrefstyle: full
:stylesdir: styles
:imagesdir: images
:version: 1.2
:stem:

And found it fixed that problem, but that the title would be repeated two pages later.

I figured this was because I hadn't removed the cover content from the CSS. After commenting it out, I found it simply led to blank pages as a cover. Then I guessed it was likely because the document title was twice in the .adoc header, but commenting that out didn't fix it.

I noticed in another issue that the :showtitle!: wasn't supported, could this be what is causing my issue? OR have I missed something in my code. I'm very new to both html and CSS.