How do I insert a background image from my disk into restructuredtext

48 views Asked by At

Including an image is easy-enough...

.. image:: /home/mpenning/ciscoconfparse_logo_bw_01.png
   :align: center

However, I want to use it as a background image... I tried this html with a z-index:

.. raw:: html

   <div>
      <style>
         body {
           background-color: white;
           background-image: url('/home/mpenning/ciscoconfparse_logo_bw_01.png');
           z-index: -1;
         }
      </style>
   </div>

However, that does not render the background image with rst2pdf.

How do I render a background image with restructured-text as a PDF (using rst2pdf)?

1

There are 1 answers

0
Mike Pennington On BEST ANSWER

This is the explicit solution that worked...

.. raw:: pdf

   PageBreak background=/path/to/backgroundimage

Total solution... FYI, center is the default...

Insert Presentation Title with normal image

.. image:: /home/mpenning/ciscoconfparse_logo_bw_01.png
   :align: center

.. raw:: pdf

    PageBreak background=/home/mpenning/ciscoconfparse_logo_bw_01.png fit-background-mode=center

- Bullet 1 (with background image)
- Bullet 2 (with background image)
- Bullet 3 (with background image)