13

I would like to create a pdf book using asciidoc. The title page should include the title, subtitle and an image. So far I could not find any documentation on how to achive this.

Intuivly I would do something like

My book title
=============
:author: myself
:toc:
image:images/titelimage.png[width=400]

but this just adds image:images/titelimage.png[width=400] as a subtitle. What I would like to have is something like

My book title
<titleimage>
subtitle

Is there a way to do this in ascciidoc? If not, what do I need to do to get this?

Isaac
  • 810
  • 2
  • 13
  • 31

5 Answers5

16

If you're using asciidoctor-pdf you can define an attribute for the logo. It will place the image above the document title.

:title-logo-image: images/titelimage.png

See an example pdf here and the raw adoc.

Leif Gruenwoldt
  • 13,561
  • 5
  • 60
  • 64
  • 2
    I think it's now called 'title-logo-image', see the [https://github.com/asciidoctor/asciidoctor-pdf/tree/master/examples](examples) directory (new link) – Gijs Aug 25 '15 at 13:39
7

If anyone is still looking for this answer, this is the correct way to do it (using asciidoctor-pdf):

= Book title
Authors
:front-cover-image: image::./images/title_page.png[]

This gives you the image by itself as the first page followed by a page that shows the title, authors, revision etc.

If you want the image on the same page as the title and author, you need to use :title-logo-image: instead.

electrichead
  • 1,124
  • 8
  • 20
2

If you want a PDF using the docbook 4.x output you should:

Generate a docinfo file with an image for the front page. This is an XML file looking like the following example. It is discussed at http://www.methods.co.nz/asciidoc/userguide.html#X87

Example:

<mediaobject>
  <imageobject>
    <imagedata align="center" depth="400" fileref="../images/tiger.png" />
  </imageobject>
</mediaobject>
<subtitle>Subtitle of this book</subtitle>

Then, customize your DocBook stylesheets to include the media element for the title page (by default the stylesheets do not include this). http://www.sagehill.net/docbookxsl/TitlePagePrint.html

DocBook 5 includes a cover element in its stylesheets.

user3660637
  • 624
  • 6
  • 16
1

This:

= The Book's Title
:author: First Last
:email: first.last@company.com
:toc:
:toc-placement: preamble
:doctype: book

image:./images/title_page.jpg[]

Produces:

My book title
first.last@company.com - first.last@company.com
Image
Table of Contents
...
craig
  • 25,664
  • 27
  • 119
  • 205
0

you just need to add a empty line between the toc and the images: instruction. That's how asciidoc kinda separates blocs.

Loic
  • 11
  • 2
  • 1
    Actually, I don't use :toc: anymore, just title. I generate a book, which automatically adds a toc. Putting the image just after the title with a free line inbetween does not do the job. – Isaac Oct 24 '13 at 13:35