0

I see that annot-pro supports customStamp: enter image description here However, it also seems to require Adobe Distiller, and I want to use pdftex/pdflatex/lualatex.

pdfcomment seems to support most annotations, but seems to only support built-in appearances. (Perhaps I'm missing something, though, and custom appearances are just not documented?)

The pdfmark documentation on ANNotations says:

In addition to these types, annotations with unrecognized Subtype values, called custom annotations, are supported. Custom annotations can contain, in addition to the Rect and Subtype keys, arbitrary key-value pairs. and

Key Type Semantics
Action(PDF key = A ) name or dictionary An action to be performed when the annotation is activated. See Actions for details. For links, this key is not permitted if the Dest key is present.
AP dictionary An appearance dictionary specifying how the annotation is presented visually. See the PDF Reference for details.

The PDF Reference says about appearance streams:

12.5.5 Appearance Streams

Beginning with PDF 1.2, an annotation may specify one or more appearance streams as an alternative to the simple border and colour characteristics available in earlier versions. Appearance streams enable the annotation to be presented visually in different ways to reflect its interactions with the user. Each appearance stream is a form XObject (see 8.10, “Form XObjects”): a self-contained content stream that shall be rendered inside the annotation rectangle.

So it seems like it should be possible to include arbitrary LaTeX content (as long as it gets stored as a "Form XObject"? What is that?) as the stamp. How do I get this to work? / How can pdfcomment be extended (or another package be used) to allow arbitrary LaTeX content at the annotation, in a way that doesn't require Adobe Distiller?

(Ultimately, I want to hack a version of the picture environment that renders every \put as a separate annotation, to allow dragging in supported PDF editors, cf Turning Adobe Reader into an interactive picture editor?. But this question is just about the custom appearances of annotations.)

1 Answer 1

1

Well such a stamp is a simple annotation, and an appearance is a simple xform. You can e.g. create them like this (I only checked in adobe reader and have no idea how other viewer handles such a stamp:)

\DocumentMetadata{}
\documentclass[11pt]{report}
\usepackage{bearwear}
\begin{document}

a default stamp
 \ExplSyntaxOn
  \pdfannot_box:nnnn {3cm}{1cm}{0cm}
    {/Subtype/Stamp /Name/Approved}
 \ExplSyntaxOff
 
\par 
\vspace{1cm}
a custom stamp
  \ExplSyntaxOn
  \pdfxform_new:nnn{mystamp}{}{\tikz[scale=0.3]{\bear\bearwear}~\Large My~stamp}
  \pdfxform_new:nnn{mystampR}{}{\tikz[scale=0.3]{\bear\bearwear[shirt=red]}~\Large My~stamp}
 
  \pdfannot_box:nnne {3cm}{1cm}{0cm}
    {/Subtype/Stamp 
     /AP~
      <</N~\pdfxform_ref:n{mystamp}
       /R~\pdfxform_ref:n{mystampR}
      >>}
  \ExplSyntaxOff
\end{document}

enter image description here

1
  • Thank you! Note for future readers: the /R is apparently for the hover image. Commented Jun 16 at 19:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .