BookmarkSubscribeRSS Feed
woshibug
Fluorite | Level 6

I searched in community and find the following code to create the hyperlink in pdf that can link to a external url of any website.

OPTION NODATE NONUMBER;
OPTIONS PAPERSIZE=A4;
OPTIONS TOPMARGIN=0.5 in BOTTOMMARGIN=0.5 in LEFTMARGIN=0.5 in RIGHTMARGIN=0.5 in;
ODS NORESULTS;
ODS PDF FILE = "E:\Desktop\TEST.pdf" dpi=1800;

data _NULL_;
set SASHELP.CLASS(obs=1);
declare odsout obj();
obj.format_text( data: "Information:",
overrides: " just=left color=green font_weight=bold font_size=8pt ");
obj.href(data:
"Adresse", url: 'https://www.test.fr/', inline_attr:'color=blue');
Run;

ODS PDF CLOSE;

But what I want is adding some internal and not external hyperlink above for a pdf like TOC(table of content) in the first page of a present pdf which has already existed. My confusion is how to add a internal and local hyperlink for a preexisting pdf.

3Q

5 REPLIES 5
Ksharp
Super User

Here is an example :

 

ods pdf file='c:\temp\temp.pdf';

title link='#xxxxx' 'whatever it is';
proc report data=sashelp.class nowd;
compute age;
if age.sum=12 then call define(_col_,'url','#yyyyy');
endcomp;
run;


ods anchor='xxxxx';
title 'heart';
proc print data=sashelp.heart(obs=10);run;

ods anchor='yyyyy';
title 'cars';
proc print data=sashelp.cars(obs=10);run;

ods pdf close;
woshibug
Fluorite | Level 6
3q,but your example above is also create a pdf,it is not a preexisting pdf.
Ksharp
Super User
You want edit already exist pdf file ? I doubt sas have such ability .
woshibug
Fluorite | Level 6
I create the hyperlink into RTF format document,then convert it into pdf and the hyperlink can work normal. but when
the data is very big and I cant get the combined RTF,so I transform lots of single rtf into single pdf,then use some app to combine pdf,then the original hyperlink can‘t work.
Ksharp
Super User
"then use some app to combine pdf,then the original hyperlink can‘t work."

That should be . sas doesn't have much control on PDF. especially for combined pdf .

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 820 views
  • 0 likes
  • 2 in conversation