Re: hyperlink to pdf files
- To: mathgroup at smc.vnet.net
- Subject: [mg45565] Re: hyperlink to pdf files
- From: Roland Franzius <roland.franzius at uos.de>
- Date: Wed, 14 Jan 2004 01:26:18 -0500 (EST)
- Organization: Universitaet Hannover
- References: <bu0dkd$amu$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi Christopher These cells after converting them from Show Expression menu all worked for me on windows 2000 Mathematica 4.01 Original pasted by right button context menu URL browser Cell[TextData[ButtonBox["Relativistische Quantenmechanik", ButtonData->{URL["file://C:\\apollo\\TeX\\RelQm\\Paper\\RelQm01.pdf"],None}, ButtonStyle->"Hyperlink"]],"Input"] Next change Options: ButtonEvaluator->Automatic and Active->True to engage kernel evaluation. We put the file on desktop to test environment evalaution. Direct reference working Cell[TextData[ButtonBox["Relativistische Quantenmechanik", ButtonData->{URL[StringJoin["file://D:\\Dokumente und Einstellungen\\Administrator\\Desktop\\","RelQm01.pdf"]], None}, ButtonStyle->"Hyperlink",Active->True,ButtonEvaluator->Automatic]], "Input"] Invoke a StringJoin to prepare the URL Cell[TextData[ButtonBox["Relativistische Quantenmechanik", ButtonEvaluator->Automatic, ButtonData:>{ URL[ StringJoin[ "file://","D:\\Dokumente und Einstellungen\\Administrator\\Desktop\\", "RelQm01.pdf"]], None}, Active->True, ButtonStyle->"Hyperlink"]], "Input"] At last we invoke Environment[ ] to get the real time language independent path Cell[TextData[ButtonBox["Relativistische Quantenmechanik", ButtonEvaluator->Automatic, ButtonData:>{ URL[ StringJoin[ "file://", Environment["userprofile"],"\\Desktop", "\\RelQm01.pdf"]], None}, Active->True, ButtonStyle->"Hyperlink"]], "Input"] Hope it helps Roland -- Roland Franzius Christopher Purcell wrote: > I would like to insert hyperlinks to pdf files in notebooks in a > platform independent way. > > I can create a cell that looks like this: > > Cell[TextData[ButtonBox["Examples Manual", > ButtonData:>{ > URL[ > "file:///Library/Mathematica/Applications/MyPackage/Documentation/ > English/References/examples.pdf"], None}, > ButtonStyle->"Hyperlink"]], "Input"] > > that works great on MacOSX to hyperlink to the file examples.pdf. I am > sure I can do something similar on Windows, provided I use Windows > style paths. > > But to have this work in a platform-independent way, > I would like to make the argument of URL[ ] to be something like: > > "file:/ > /"<>ToFileName[{$AddOnsDirectory,"MyPackage","Documentation","English"," > References"},"examples.pdf"] > > But this doesn't work. Putting Evaluate around it does not help. URL or > ButtonData reject everything except the explicit text string. Any other > ideas? > > > > > Christopher Purcell > Sensors & Actuators Group > DRDC-Atlantic, 9 Grove St., PO Box 1012, > Dartmouth NS B2Y 3Z7 Canada > Tel 902-426-3100 x389 > Fax 902-426-9654 >