The SAS Output Delivery System and reporting techniques

ODS PDF links

Reply
SAS Employee
Posts: 47

ODS PDF links

Is it possible to create links with ODS PDF that would link to page x in an already existing PDF file ?

Thanks,

Lex Jansen
SAS Super FREQ
Posts: 8,868

Re: ODS PDF links

Hi:
I don't know about linking to a particular page number. If there's a way to do it, that might be possible with Adobe Acrobat adding something to an existing PDF file.

With ODS, you can use ANCHOR= and LINK= to do "internal" links. This code:
[pre]
proc sort data=sashelp.shoes out=shoes;
by Region;
where Region contains 'Europe';
run;

ods pdf file='c:\temp\anchor.pdf' anchor='Eur1';
proc print data=shoes;
by Region;
title 'European Report';
footnote link='#Eur1' 'Back To Top';
footnote2 link="http://www.setgame.com" "Play a Game Instead";
run;
ods pdf close;
[/pre]
sets the starting ANCHOR (or named section) to #Eur1 (instead of #IDX -- which is the default). So in that case, with a LINK= for #Eur1, PDF navigation will take you back to the section named at the top of the file. To the extent that you can say that every by group starts a new page, then #Eur1 would take you to the first named section, then #Eur2 would take you to the second named section -- which may or may not be the second page. Compare this to the regular behavior of LINK= in the footnote, which will take you outside the document to a web site (assuming you have network connectivity).

This (ANCHOR=) may NOT work in all versions of Acrobat Reader. ANCHOR= in HTML makes a named section using HTML tags. ANCHOR= works a bit differently for RTF and PDF. For RTF, there is a "bookmark" RTF control string that gets inserted into the document. For PDF, I'm not sure how ANCHOR= works behind the scenes.

cynthia
N/A
Posts: 0

Re: ODS PDF links

Posted in reply to Cynthia_sas
I found the section above on PDF links seemingly useful but then when I used it in my application I found that it does not work.

ods pdf file='c:\temp\anchor.pdf' anchor='Class1';
proc gchart data=sashelp.class;
title 'Student Information';
vbar age / discrete des='Age';
vbar sex / discrete des='Sex';
footnote link='#Class1' 'Back To Top';
run;
quit;
ods pdf close;

this code is similar to what has been done above but using proc gchart rather than proc print. When running this code notice that the links on the PDF do not display with the hyperlink boxes around them as they do in the previous example. Is the syntax different for procs gchart/gplot as compared to proc print? Is there a way to use links within procs gchart/gplot? And lastly, if there is a way to link in gchart, is there a way to link between pages such that the Age chart would have a link to the Sex chart?

Thanks as always.
Johnny
SAS Super FREQ
Posts: 8,868

Re: ODS PDF links

Posted in reply to deleted_user
Hi:
I do not believe that LINK= is supported in SAS/Graph procedures. That is something you could check with Tech Support.

cynthia
Ask a Question
Discussion stats
  • 3 replies
  • 187 views
  • 0 likes
  • 3 in conversation