gotenberg
gotenberg copied to clipboard
Watermarks
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!
This is a cool option to add in my opinion 😄
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?
No sorry I don't know any libraries in go for that purpose.
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.
Hello @skys215
I think it is a LibreOffice limitation. If you try to convert your docx
with LibreOffice, you will obtain the same result.
Ok, let me have a try.
Yeah, it's LibreOffice's limitation.
I found such library written in go maybe it can help https://github.com/ajaxray/markpdf
@nvelychenko looks great but its license might conflict with some Gotenberg usage alas..
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);
}