New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PDF watermark from Reader #472
Comments
Hello! I am not quite sure what you are looking for. In case you are looking for something similar to: maybe: then that can't be done. A PDF resource for stamping/watermarking is a combination of some content stream bytes, its resources and a bounding box whereas an Image resource can be represented by a simple byte slice. On top of that pdfcpu supports multi-stamps where each page of the input PDF gets stamped with a different page of the PDF stamp source file. See more here: https://pdfcpu.io/core/stamp |
Excuse me for being that brief, consider the following usecase: the watermark is generated on-the-fly for each incoming PDF from some metadata, thus it's inconvenient to save the watermark beforehand to the file. The code that generates the watermark is on another process/host. Thank you for identifying the problem with
|
Another option (to keep the interface more consistent) is to copy data from |
Generating a pdfcpu PDF watermark somewhere in order to use it later on for stamping is a valid use case but can't be done easily. Like already expained above, a PDF watermark is a non trivial object consisting of some content bytes, its resources and some metadata. Sure, we could write out this object/blob as a file, but this is not practical because of its required resources, especially when some embedded user fonts are involved. A much better alternative is to to render the PDF watermark to an image but that's not an option right now. Switching from io.Reader to an io.ReadSeeker doesn't change anything AFAIC. I need to think more about this because I like the use case. |
This is part of https://github.com/pdfcpu/pdfcpu/releases/tag/v0.6.0 |
Looks like currently it's impossible to create PDF watermarks via Reader (or byte slice, etc.), only from file:
pdfcpu/pkg/pdfcpu/stamp.go
Line 1192 in e89570a
It would be really handy to add such a feature. Furthermore it's already there for Image watermarks:
pdfcpu/pkg/pdfcpu/stamp.go
Line 1224 in e89570a
The text was updated successfully, but these errors were encountered: