is there a way to have hyperref produce links in the resulting
PDF file which are colored only when it is being viewed on screen,
but not when printed? In CSS-land, one would use
@media print { ... }
@media screen { ... }
to do such a thing; cf. <http://www.w3.org/TR/CSS21/media.html#media-
sheets>
Cheers.
-- m
I think the actual text of the hyperlink is written with LaTeX and
the clickable stuff is via PDF hacks. It might suffice to use a
custom color that doesn't look so bad, or use borders around the link
(the borders shouldn't print, or you should be able to alter the flags
so they don't print). The link feature uses the /Link annotation type
within the PDF. The flags that affect PDF annotations won't affect
the LaTeX text. See the PDF reference manual, section 8.4.2
"Annotation Flags"
http://www.adobe.com/devnet/acrobat/pdfs/pdf_reference.pdf
This shows a custom color for the link and an attempt to mannually
create a link:
\documentclass{memoir}
%
% also explore the pdfannotlink command
%
%
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{color}
\definecolor{mycolor}{rgb}{0.4,0.7,0.7}
% note that the colorlinks option of true removes
% the link border, but borders might not work in all browser
\hypersetup{bookmarks=true,colorlinks=true,urlcolor=mycolor,
urlbordercolor=0.3 0.9 0.3,citecolor=red,pdfmenubar=true,
pdfauthor={Your Name},pdfpagemode=None,
pdfpagelayout=TwoColumnRight,hyperfootnotes=true,
hyperfigures=true,hyperindex=true,pdfstartview=FitH}
%
%
\begin{document}
\setbox0=\hbox{test link}%
\edef\mywd{\wd0}%
\edef\myht{\ht0}%
\expandafter\pdfannot width \mywd height 14pt{
/Subtype /Link
/Contents (this is the main contents.)
/A << /Type/Action
/S/URI/URI(http://groups.google.com/group/comp.text.tex)
>>
}\box0
Regular hyperref test using custom color:
\rlap{hello}\href{http://reddit.com}{hello}
\end{document}
There is support in PDF for "optional content" (I've just been looking
in the v1.7 reference section 4.10) but I don't know how well
supported that kind of thing is outside of Acrobat Reader itself.
I haven't looked into it enough to know what to do next, but I really
like the idea of it. A PDF that could have colours when viewed on
screen and distinguishable black and white patterns when printed
greyscale would be pretty nice.
Will
This is route I've used in the past: make links dark blue:
\usepackage{color}\definecolor{darkblue}{rgb}{0,0,0.5}
\usepackage[hyperfootnotes=false,
colorlinks,urlcolor=darkblue,linkcolor=black]%
{hyperref}
And when I'm in control of printing, I just switch to
\usepackage{nohyperref].
I have no ideas for automating the switch, but it sure would
be nice. Although, I would also want a footnote to appear for
the printed version that informed them they are missing
something (links).
Regards,
--
Bil Kleb
http://twitter.com/bil_kleb
That's doable. But I after the possibility of having
both the links in color for on-screen viewing, and
everyhing in black for printing from te *same*
pdf file.
-- m
> > >> is there a way to have hyperref produce links in the resulting
> > >> PDF file which are colored only when it is being viewed on screen,
> > >> but not when printed?
You have other color things in the document, so you cannot just print
in black&white ?
--
G. A. Edgar http://www.math.ohio-state.edu/~edgar/
Coloring the links is useful when viewing on screen because
it provides visual clue that there is a link. When the
document is printed, there is no point in having that clue,
because the link is not there anymore. Whether there be other
color things in the document does not change that ;-)
-- m
But having NO color things in the document makes it easy to print,
just choose black&white print. Isn't that what was desired in
the first place? Don't change the PDF file, instead change the
choices you make when you print.
At the risk of being repetitive, what was desired
in the first place was a way to have the PDF be
rendered differently accoding to the media it is
rendered to, in the specific aspect of the coloring
of the links it contains.
-- m
Indeed, section 4.10.3 looks like this should be possible...
-- m
sometimes the color links are printed in a lighter shade than ordinary
text, and sometimes that is distracting.
> That's doable. But I after the possibility of having
> both the links in color for on-screen viewing, and
> everyhing in black for printing from te *same*
> pdf file.
I guess it could be possible, but I don't know how. If you have your links
"framed" (the default with hyperref, I think), the frame is not printed.
And I remember having some pdf file that printed big black circles over the
text, which were not present in the screen (but it could have been a bug in
the reader or in the printer driver...). There is the possibility of having
text in the screen which is not selected with the text-select tool (in
acroread)... So I would guess what you want is possible.
--
Ignacio __ Fernández Galván
/ /\
Linux user / / \ PGP Pub Key
#289967 / / /\ \ 0x01A95F99
/ / /\ \ \
http://djelibeibi.unex.es
/________\ \ \
jellby \___________\/ yahoo.com
However 4.10.2 states that color settings are still applied.
Thus the link text must be put in a box and set twice, with
and without color.
Now hyperref v6.77r comes with an experimental option
`ocgcolorlinks' for pdftex and dvipdfm that uses Optional
Content Groups for colored links.
Yours sincerely
Heiko <ober...@uni-freiburg.de>