1
votes

I would like to use ghostscript to add an annotation to a pdf file, similar to the method described here. However, instead of a text annotation, I want to add an image as an annotation. Given what I have read in the pdfmark reference and the pdf reference, I think it should be possible by inserting a "custom" rubber stamp annotation. If anyone could provide an example of how to do this, I would be very appreciative.

1

1 Answers

2
votes

You basically need to define an Appearance (/AP) stream for your annotation. If you want to use an image then the AP stream either needs to contain an inline image (assuming its reasonably small) or you need to create a Named Image so that your AP stream can refer to the image by name.

I don't have an example of a pdfmark to do this, but it should be reasonably easy to start by creating a stamp annotation with a simple appearance stream. Something like '0 1 0 0 k 10 10 20 20 re f' would draw a 10x10 magenta rectangle. After that you could move on to images.