From p.murrell at auckland.ac.nz  Mon May  5 00:39:08 2008
From: p.murrell at auckland.ac.nz (Paul Murrell)
Date: Mon, 05 May 2008 10:39:08 +1200
Subject: [Rd] A patch for extending pdf device to embed popup text and
 web	links
In-Reply-To: <481DE090.3020808@telenet.be>
References: <dcb3073c0805040854m76eb163dnef5af8dad5becdc9@mail.gmail.com>
	<481DE090.3020808@telenet.be>
Message-ID: <481E3B0C.7090300@stat.auckland.ac.nz>

Hi


Tobias Verbeke wrote:
> Dear Tadashi,
> 
> Thank you very much for sharing your work.
> 
>> I am sending a patch for R-2.7.0 for extending pdf device to embed pop
>> up text and
>> web links. The patch is available at
>> http://www.okada.jp.org/RWiki/?plugin=attach&pcmd=open&file=R-2.7.0.patch&refer=pdf%20device%20patch
>> You can see what the patch can do through a sample output, which is available at
>> http://www.okada.jp.org/RWiki/?plugin=attach&pcmd=open&file=sample2.pdf&refer=pdf%20device%20patch
>> An script is at
>> http://www.okada.jp.org/RWiki/?plugin=attach&pcmd=open&file=sample2.r&refer=pdf%20device%20patch
>>
>> Ei-ji Nakama kindly build Windows binary, which can be obtained from
>> http://prs.ism.ac.jp/~nakama/tadakadosan/cran/
>> An installer, R-2.7.0pat-win32.exe, will install programs in
>> C:\Program Files\R\R-2.7.0pat
>> so that you can use both of original and patched version simultaneously.
> 
> I think it would be most useful if you could bundle your patched version
> of the pdf device in a separate device package, similar to the
> RSVGTipsDevice.


I would second that approach, at least in the meantime.  This sort of
functionality is interesting and useful, but needs careful thought to
make it compatible with the existing graphics facilities in R.

One major consideration is that the graphics system tries to be mostly
device-independent, so that R graphics code can be run on any device.
This would need adjustments to the common graphics engine/device C code
rather than just to the C code underlying the PDF device.

There is also the issue of following standard R coding style and
semantics.  Rather than your approach of ...

text(5, 2, "text test")
pdf.link.on.text("http://www.google.com")

... where the second call relies on a global setting to relate to the
appropriate text, it would be better to have something like ...

linkedText(5, 2, "text test", href="http://www.google.com")

... so that the association is explicit.

By developing your ideas as an add-on package, people can try out your
ideas without having to recompile R.  As Tobias has pointed out, the
RSVGTipsDevice package might be a good place to start.

Paul



> What do you think ?
> 
> Kind regards,
> Tobias
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

-- 
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
paul at stat.auckland.ac.nz
http://www.stat.auckland.ac.nz/~paul/



[Rd] A patch for extending pdf device to embed popup text and web links
Paul Murrell