gotenberg icon indicating copy to clipboard operation
gotenberg copied to clipboard

Watermarks

Open ohartl opened this issue 6 years ago • 11 comments

Expected Behavior

Ability to overlay the .pdf with a watermark per page on the same position.

Context

I don't know this is something that should be part of the project as something like that could be done with other tools, but I'd like to suggest this and have an opinion from the maintainers.

Thanks for the nice tool!

ohartl avatar Dec 20 '18 22:12 ohartl

This is a cool option to add in my opinion 😄

gulien avatar Dec 21 '18 08:12 gulien

So, after looking at possible solutions:

  • pdfcpu: does not work great (watermarks are sometimes hidden by the content)
  • bimg: I've failed to install the required dependency libvips (there is a discussion about it here)

Do you know a better tool for the job?

gulien avatar Dec 21 '18 16:12 gulien

No sorry I don't know any libraries in go for that purpose.

ohartl avatar Dec 23 '18 20:12 ohartl

I tried to convert a docx with a watermark(50% of opacity) to pdf, but the watermark shows over the pdf content, it doesn't show under the content with transparency.

skys215 avatar Sep 28 '20 05:09 skys215

Hello @skys215

I think it is a LibreOffice limitation. If you try to convert your docx with LibreOffice, you will obtain the same result.

gulien avatar Sep 28 '20 07:09 gulien

Ok, let me have a try.

skys215 avatar Sep 28 '20 07:09 skys215

Yeah, it's LibreOffice's limitation.

skys215 avatar Sep 28 '20 07:09 skys215

I found such library written in go maybe it can help https://github.com/ajaxray/markpdf

nvelychenko avatar Jan 18 '22 13:01 nvelychenko

@nvelychenko looks great but its license might conflict with some Gotenberg usage alas..

gulien avatar Jan 18 '22 13:01 gulien

If you are using an html template to generate your pdf, here is a working solution:

body {
    position: relative;
}

body:before {
    content: 'Draft';
    position: fixed;
    inset: 0;
    font-size: 180px;
    font-weight: bold;
    display: grid;
    justify-content: center;
    align-content: center;
    opacity: 0.1;
    transform: rotate(-45deg);
}

Mistes974 avatar Jun 06 '23 11:06 Mistes974