MATLAB Answers

0

How can I save a text in a PDF that is a hyperlink to a webpage?

I want to create a picture, and add some text to this picture.
This text should be linked to an html link when I create the PDF file through the SAVEAS or PRINT command.
For instance, I would like to add some instruction into the following snippet of code
 
H_fig=figure('units','centimeters');
text(0.05, 0.95, 0.0,'Mathworks')
saveas(H_fig,'Hyperlink To Mathworks.pdf','pdf')
%%Instruction to add a link
to create a pdf with the text Mathworks linked to the site http://www.mathworks.com
 

Products


Release

R2013b

1 Answer

Answer by MathWorks Support Team on 21 Feb 2017
Edited by MathWorks Support Team on 16 Mar 2018
 Accepted Answer

The capability to get a hyperlink, when adding a simple link :
e.g., text(0.05, 0.95, 0.0,'http://www.mathworks.co.uk')
 to an exported figure, is something completely handled by Adobe, and not by our software. 
As a counter example, in MATLAB, you can emulate a hyperlink on a figure by adding a "ButtonDownFcn" callback to the text, but this hypelink will not be exported into the PDF. 
In other words the commands SAVEAS and PRINT work independently from the Adobe Tools (which interprets the figure generated in MATLAB). 
A workaround, is to create a text handle with the name, e.g., 'Mathworks': 
 
text(0.05, 0.95, 0.0,'Mathworks')
and then you add a hyperlink to 'http://www.mathworks.com', directly from Adobe Acrobat, as the following link shows:

  0 Comments

Sign in to comment.