Front Cover Image

When using a title page, you might want to set a front cover image. To do that, you will need to add a few lines of CSS.

Here’s a complete example:

  1. Create a file named orly.adoc with the following content:

    = Hoping This Works
    :doctype: book
    
    == Guessing
    
    The first step is guessing.

    We are using :doctype: book to get a title page.

  2. Create a file named orly.css with the following content:

    @page :first {
      background-size: contain;
      background-image: url("./orly.jpg");
    }
    
    /* move the book title to the correct location */
    #cover > h1 {
      color: white;
      margin-top: 8cm;
      font-size: 7rem;
    }
  3. Download the image orly.jpg and put it next to the orly.adoc file.

  4. Open a terminal and type:

    asciidoctor-web-pdf orly.adoc -a stylesheet="+orly.css"

The above command will create a file named orly.pdf which should look like:

front cover image