Add Watermarks to Senaite Impress COAs [Solution]

Time to add value to the community :slight_smile:

I added watermarks to the COAs - turned out super cool. Can use your own lab logo or co-opt a field to use the client’s logo; I used the Tax Number field in this example.

Started by modifying the MultiDefaultbyColumn.pt report and including the following code above Report Controls. If you don’t want to pull client fields you don’t need to modify the <tal:report portion at the beginning.

<tal:report define="model python:view.model;
                    client model/Client"
                    i18n:domain="senaite.impress">

 <!-- WATERMARK LOGO -->
 <div style="position: fixed;
              top: 0;
              left: 0;
              width: 100%;
              height: 100%;
              opacity: 0.3;
              z-index: 9999;
              pointer-events: none;">
    <img tal:attributes="src python:'++plone++senaite.core.static/images/' + client.TaxNumber if client.TaxNumber else '++plone++senaite.core.static/images/YOUR-LOGO.png'"
         style="position: absolute;
                bottom: 0;
                left: 50%;
                transform: translate(-50%, -100px);
                max-width: 100%;
                max-height: 100%;
                object-fit: contain;
                opacity: 0.3;" />
  </div>

Then you upload the image file(s) to /senaite/buildout-cache/eggs/cp27mu/senaite.core-2.5.0-py2.7.egg/senaite/core/browser/static/images folder on your webserver.

If you want to use client images, with this code you would plug the image filename into the client Tax Number field and it will pull that and watermark the COA with it.

Hope this helps!

3 Likes