6

I'm trying to get a pdf file I'm composing (using LaTeX et. al.) to have a functional hypertext link that will open a remote pdf file on the web (ideally in the same PDF viewer I'm using to read the one I'm composing although I don't think that's possible is it?) and then navigate to a certain page while fitting the height of that page to the viewing window.

Here's my MWE:

\documentclass[12pt]{article}
\usepackage{geometry} 
\geometry{letterpaper}  
\usepackage{graphicx}
\usepackage{amssymb}
\usepackage[colorlinks=true,urlcolor=cyan]{hyperref}

\title{Brief Article}
\author{The Author}

\begin{document}
\maketitle


I want this \href[page=10,pdfremotestartview=FitV]{http://www.ctex.org/
documents/packages/layout/geometry.pdf}{link} to take me to page 10 of the 
linked PDF file while fitting the height of the page to the window. And while 
it does switch to my web browser which then downloads the PDF file and opens 
that file (using the browser plugin) in a browser window, the browser/plugin 
does not navigate to page 10 or fit the vertical height of the page to the 
window.

\end{document}

As I write in the MWE, it works part of the way, but not all the way.

Am I doing something wrong here?

I found this, but I think it's much more complex a problem than the one I face, and although it was helpful to me, it didn't completely solve the problem I'm having now.

Any suggestions?

TeXnewbie
  • 1,489

1 Answers1

7

These parameters for \href are only defined for "Remote Go-To Actions" (/GoToR), PDF files on the file system, not URLs.

In case of a URL the parameters can be given the following way:

\documentclass[12pt]{article}
\usepackage[colorlinks]{hyperref}

\begin{document}
\href{http://mirror.ctan.org/macros/latex/contrib/geometry/geometry.pdf#page=10&view=FitV}{link}
\end{document}

However, it depends on the browser and PDF plugin, whether and how these settings are working.

The parameters are specified in Adobe's "PDF Open Parameters".

Heiko Oberdiek
  • 271,626
  • I see. Thanks for clarifying. My only regret now is that this doesn't seem to work inside a pullquote environment. Any idea for a work-around on that? I see the words in the Adobe document that, "You cannot use the reserved characters =, #, and &. There is no way to escape these special characters." but that seems to relate to use of those three characters in the file URL itself rather than parameters for use in navigating the file. – TeXnewbie Aug 25 '13 at 00:12
  • @TeXnewbie: Which package provides pullquote? – Heiko Oberdiek Aug 25 '13 at 00:26
  • I think it's under development, but I have it working at least marginally right now, and it's really beautiful. – TeXnewbie Aug 25 '13 at 01:04
  • On a gut instinct, I tried escaping the # character with the \ character to make this in the Adobe Open Parameter, and although it breaks in html, it now works great in my .tex file within a pullquote environment too. Thanks very much @Heiko! – TeXnewbie Aug 25 '13 at 01:09
  • I'm experimenting with some of the other options in the hyperref package and I don't get the desired behavior from the pdfnewwindow=true option for URLs either. I'm guessing that's because it too is defined only for PDF files on the local filesystem? Is there some way to do the same thing for URLs? I don't see anything in Adobe's PDF Open Parameters. – TeXnewbie Aug 25 '13 at 04:11
  • @TeXnewbie: pdfnewwindow controls the PDF action flag /NewWindow that is defined for opening PDF files on the file system, not for URI actions. A PDF viewer cannot open arbitrary files (HTML, ...) in the same window. – Heiko Oberdiek Aug 25 '13 at 06:44
  • Sorry, I should have been more specific. I meant in the case that I'm viewing the PDF file using a web browser and plugin combination. I'd like to have PDF files linked to in my PDF file be opened by the browser/plugin combination in a different tab or window than my PDF file. As you wrote, it's apparently possible with the pdfnewwindow option for files on the filesystem. But I'm wondering if there is anything in either hyperref or the Adobe Open Parameters to allow me to open a remote URL (PDF file or html) in a new tab or window than the originating document. Maybe I should ask a new Q? – TeXnewbie Aug 25 '13 at 07:48
  • @TeXnewbie: The PDF format does not have a /NewWindow for /URI actions, because it is out of control of the PDF viewer, how URLs are handled by a web browser. – Heiko Oberdiek Aug 25 '13 at 07:52