Is it possible to use some dll LibreOffice to record a watermark in a PDF file programmatically?

I’m trying to apply watermark in an existing PDF file.

Using LibreOffice I have to follow the following steps:

  1. Open the PDF as image
  2. Select Insert, select Figure
  3. Select the Gif file with the Watermark
  4. Open

Anyone know how I can do it programmatically?