0

I use Libreoffice Draw for drawing block diagrams. I export them automatically on the command line using the following command:

soffice --headless --convert-to pdf --outdir figures figures_raw/foo.odg

However, this does not preserve transparency - the background is always white. How to convert odg drawings to pdf but preserver the transparency?

Razer
  • 7,843
  • 16
  • 55
  • 103
  • Good question, but probably this is a [better place](https://ask.libreoffice.org/en/questions/) to ask. – z-- Sep 04 '15 at 09:57
  • A PDF by specification does not support transparency to the outside; it merely supports transparency among its inner building blocks but the PDF as a whole is specified to live on a white backdrop. – mkl Sep 30 '15 at 16:02

1 Answers1

-1

However, this does not preserve transparency - the background is always white.

This is so by specification. In the PDF specification, when covering the topic of transparency,

the notion of current page is generalized to refer to a transparency group consisting of the entire stack of objects placed on the page, composited with a backdrop that is pure white and fully opaque.

(section 11.2 Overview of Transparency, ISO 32000-1)

Thus, PDF viewer programs or viewing controls usually will display a PDF with a white, opaque background.

Community
  • 1
  • 1
mkl
  • 90,588
  • 15
  • 125
  • 265
  • 1
    Here's a post on the OpenOffice forum (https://forum.openoffice.org/en/forum/viewtopic.php?f=11&t=66631&hilit=pdf%20transparent) that shows how to do it in the user interface (I don't think this method will work in headless mode). You can select the objects you want to export, 'Export as PDF, then under 'Range' choose 'Selection'. – Jon Hulka Jul 21 '18 at 18:13
  • And a conforming pdf viewer will still display the rest of the page in white, won't it? – mkl Jul 22 '18 at 06:20
  • I've no idea. In my case I was using pdftk to stamp one page onto another, so the stamp had to have a transparent background, and it does so far as pdftk is concerned. The output is clearly different from the usual method of exporting to PDF. I put my comment here in case anyone else runs across this looking to do something similar. – Jon Hulka Jul 22 '18 at 23:53