# Attachfile or attachfile2 in landscape mode

I want to use attachfile or attachfile2, with Paperclip icon, inside a \begin{landscape} section. Everything is ok, but the icon showed is not rotated, so it has a strange looking. Anyone knows how to get it correctly?

Another option could be using a custom icon, a rotated version of Paperclip icon. But there seems no way to use a custom icon...

In the first page of the example below, the icon is shown correctly, but in the second page (landscape mode), the icon is not rotated...

MWE:

\documentclass{article}
\usepackage{attachfile}
\usepackage{pdflscape}
\usepackage{lipsum}

\begin{document}

\lipsum[1-2] Click here.

\attachfile{example.tex}

\begin{landscape}
\lipsum[1-2]
Click here.
\attachfile{example.tex}
\end{landscape}
\end{document}


I got the following kind answer from the attachfile2 package maintainer, Heiko Oberdiek:

(answer begins here)

It is not related to attachfile2, because the problem is already
present in attachfile.

• Annotation boxes are rotated, but not the contents (or vice versa).
Therefore the result is distorted (height is stretched to width and
vice versa).

• It could be fixed easier if the driver would allow the manipulation of the transfer matrix of the annotation. But, pdfTeX does not provide such a way after a quick look.

• I haven't analyzed the situation with the other drivers supported by attachfile2.

A fix is not trivial:

• A general detection of rotated pages is not trivial.

• pdfTeX: Atpage shipout time, the contents of register \pdfpageattr needs to be analyzed (parsed as PDF objects -- TeX is not the best programming language for this). Also \pdfpagesattr needs to be inspected. The annotations must remember the page (some label/ref mechanism via the .aux file). ...
• The affected annotation boxes needs to be rotated appropriately.

(answer ends here)

I was thinking about this, and I think a workaround could be possible. Now it is possible to specify a desired icon to show. Currently, Graph, Paperclip, PushPin, and Tag are the possible options. As the user usually knows which page orientation is beign used, I think that adding the 90 degrees rotated icons to the available options would make the trick. Thus, if the page is in landscape mode, the user would be able to choose Graph90, Paperclip90, PushPin90 or Tag90, for example, to get the icon correctly shown.

I looked at attachfile2 package, and it seems Paperclip icon is defined as:

28 \newcommand{\atfi@acroPaperclip@data}{%
29 q 0.75 G 0 i 2.5 w 1 J 4 M 1.9619 11.7559 m 1.9619 3.3037
30 1.9619 2.5059 v 1.9619 1.707 4.0947 1.25 y 7.4141 1.25 l 9.4292
31 1.8223 9.4292 3.3066 v 9.4292 4.79 9.4292 16.8945 y 9.7852
32 18.1514 8.481 18.1514 v 7.1768 18.1514 5.1616 18.1514 y 3.8574
33 17.9209 3.8574 16.8945 v 3.8574 15.8652 3.8574 6.6172 y 4.3325
34 5.418 5.1025 5.418 v 5.8726 5.418 6.5845 5.418 y 7.6812 5.6455
35 7.6812 6.4736 v 7.6812 7.3027 7.6812 11.5264 y S 0 G 1.2495
36 12.4404 m 1.2495 3.9883 1.2495 3.1895 v 1.2495 2.3906 3.3833
37 1.9326 y 6.7026 1.9326 l 8.7178 2.5068 8.7178 3.9902 v 8.7178
38 5.4736 8.7178 17.5781 y 9.0732 18.834 7.769 18.834 v 6.4653
39 18.834 4.4497 18.834 y 3.146 18.6055 3.146 17.5781 v 3.146
40 16.5498 3.146 7.3018 y 3.6201 6.1016 4.3911 6.1016 v 5.1611
41 6.1016 5.873 6.1016 y 6.9692 6.3301 6.9692 7.1572 v 6.9692
42 7.9863 6.9692 12.21 y S \atfi@color@rgb\space RG 1 w
43 1.2495 12.4404 m 1.2495 3.9883 1.2495 3.1895 v 1.2495 2.3906
44 3.3833 1.9326 y 6.7026 1.9326 l 8.7178 2.5068 8.7178 3.9902 v
45 8.7178 5.4736 8.7178 17.5781 y 9.0732 18.834 7.769 18.834 v
46 6.4653 18.834 4.4497 18.834 y 3.146 18.6055 3.146 17.5781 v
47 3.146 16.5498 3.146 7.3018 y 3.6201 6.1016 4.3911 6.1016 v
48 5.1611 6.1016 5.873 6.1016 y 6.9692 6.3301 6.9692 7.1572 v
49 6.9692 7.9863 6.9692 12.21 y S Q
50 }


I would like to get a 90 degrees rotated version of the Paperclip icon, but I don't understand this kind of definition. Is it using any drawing package? Where can I find any specification of these drawing commands?

Could anyone point me to any source of information about this?