# pdftooltip of pdfcomment package doesn't work in landscape mode

I try to use the \pdftooltip{} of the pdfcomment package in a document in landscape mode. The mouseover works in normal mode, but fails in landscape mode. In landscape mode onley the first character does a mouseover instead of the whole word. I render the pdf with this rmarkdown script (the first page has a normal tooltip, the second has a wrong one):

---
output:
pdf_document:
latex_engine: xelatex
number_sections: no
keep_tex: true
mainfont: Open Sans
- \usepackage{grid-system}
- \usepackage[framemethod=TikZ]{mdframed}
- \usepackage{xcolor}
- \usepackage{geometry}
- \geometry{top=0.2cm,margin=0.2cm}
- \usepackage{atbegshi}
- \usepackage{pdflscape}
- \usepackage{hyperref}
- \usepackage[document]{ragged2e}
- \usepackage{pdfcomment}
---

\pdftooltip{\mbox{mouseover1}}{this is a mouseover text}
\begin{landscape}
\pdftooltip{\mbox{mouseover2}}{this is a mouseover text}
\end{landscape}


This is LaTeX file it makes before rendering the pdf:

\documentclass[]{article}
\usepackage{lmodern}
\usepackage{amssymb,amsmath}
\usepackage{ifxetex,ifluatex}
\usepackage{fixltx2e} % provides \textsubscript
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\else % if luatex or xelatex
\ifxetex
\usepackage{mathspec}
\else
\usepackage{fontspec}
\fi
\defaultfontfeatures{Ligatures=TeX,Scale=MatchLowercase}
\setmainfont[]{Open Sans}
\fi
% use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
% use microtype if available
\IfFileExists{microtype.sty}{%
\usepackage{microtype}
\UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
}{}
\usepackage[margin=1in]{geometry}
\usepackage{hyperref}
\hypersetup{unicode=true,
pdfborder={0 0 0},
\urlstyle{same}  % don't use monospace font for urls
\usepackage{graphicx,grffile}
\makeatletter
\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi}
\def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi}
\makeatother
% Scale images if necessary, so that they will not overflow the page
% margins by default, and it is still possible to overwrite the defaults
% using explicit options in \includegraphics[width, height, ...]{}
\setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio}
\IfFileExists{parskip.sty}{%
\usepackage{parskip}
}{% else
\setlength{\parindent}{0pt}
\setlength{\parskip}{6pt plus 2pt minus 1pt}
}
\setlength{\emergencystretch}{3em}  % prevent overfull lines
\providecommand{\tightlist}{%
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\setcounter{secnumdepth}{0}
% Redefines (sub)paragraphs to behave more like sections
\ifx\paragraph\undefined\else
\let\oldparagraph\paragraph
\renewcommand{\paragraph}[1]{\oldparagraph{#1}\mbox{}}
\fi
\ifx\subparagraph\undefined\else
\let\oldsubparagraph\subparagraph
\renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}}
\fi

%%% Use protect on footnotes to avoid problems with footnotes in titles
\let\rmarkdownfootnote\footnote%
\def\footnote{\protect\rmarkdownfootnote}

%%% Change title format to be more compact
\usepackage{titling}

% Create subtitle command for use in maketitle
\newcommand{\subtitle}[1]{
\posttitle{
\begin{center}\large#1\end{center}
}
}

\setlength{\droptitle}{-2em}
\title{}
\pretitle{\vspace{\droptitle}}
\posttitle{}
\author{}
\preauthor{}\postauthor{}
\date{}
\predate{}\postdate{}

\usepackage{grid-system}
\usepackage[framemethod=TikZ]{mdframed}
\usepackage{xcolor}
\usepackage{geometry}
\geometry{top=0.2cm,margin=0.2cm}
\usepackage{atbegshi}
\usepackage{pdflscape}
\usepackage{hyperref}
\usepackage[document]{ragged2e}
\usepackage{pdfcomment}

\begin{document}

\pdftooltip{\mbox{mouseover1}}{this is a mouseover text}

\begin{landscape}
\pdftooltip{\mbox{mouseover2}}{this is a mouseover text}
\end{landscape}

\end{document}


Does anyone know what's going wrong here? Is there a solution for making pdftooltip work in landscape mode?

EDIT Thanks to the comments I sort of understand what happens. The \pdftooltip{} doesn't seem to rotate to landscape mode. How can we solve this?

• I can only guess, as my PDF viewer doesn't display tooltips and I'm not gonna install adobe on my machine. But I wonder whether the tooltip does show up if you place your cursor vertically beneath the first character of the landscape word. If so that would be funny/interesting. – Skillmon Feb 22 '18 at 12:47
• @Skillmon yes that happens!! so the pdftooltip doesn't inherit the landscape mode... – rdatasculptor Feb 22 '18 at 12:48
• Rotating annotations is difficult. You can find a number of questions about it. – Ulrike Fischer Feb 22 '18 at 12:53
• I think this may be related. (I'm not saying the question is a duplicate!) – user121799 Feb 22 '18 at 14:11
• I think no one but @AlexG could help you here ;-) – user121799 Feb 22 '18 at 15:30