Closed 8vius closed 5 years ago
@8vius ,
CombinePDF isn't really an authoring tool. It was designed to allow me to combine pre-made templates and add page numbering.
Basically the tool deconstructs the PDF and allows the user to manipulate the different PDF parts or copy them to a different PDF.
Hence, the stamping tool is mostly limited to stamping one PDF page over another.
If the image is already in PDF format, the stamping tool will work. If it isn't in PDF format, than you might consider an authoring tool (i.e., prawn
) that will allow you to convert the image to PDF and place it in the right spot before combining the result using CombinePDF.
It's possible to resize or rotate a page before stamping, allowing for some manipulations using the existing page manipulation API.
By using the #resize
method with an offset (i.e., stamp.resize([100, 100, 100 + stamp.page_size[3] - stamp.page_size[1] , 100 + stamp.page_size[4] - stamp.page_size[2]])
), the stamp could be placed to the "side", moving the stamped data and changing the result.
Another option is to manipulate the PDF objects manually, after all, the API is basically a convenience wrapper around PDF object manipulations (maybe submit a PR if you author a cool method).
Good luck, Bo.
Thanks for the response @boazsegev, what I get is that if I want to achieve this with the current functionality I'd have to have a PDF file with the image already in the position I want it in to stamp it correct? Or position it myself with another tool.
Yes, you understand correctly.
Another option is available if you have a full-page version of the image in PDF format, you could resize it while placing it at the coordinate you want using the #resize
method and than use the resized PDF page as a stamp (note that PDF XY coordinates start at the bottom right corner).
Is there currently anyway to stamp an image at a location? I've seen on the README you can add an image from another PDF file but I don't quite understand how that works or what it comes out to.