As you see, there are several IDs around the circle, I don't know exactly about their coordination (is difficult!). So, was wondering if anyone has an idea, to attach hyperlink for each ID, meaning that by clicking on ID, user diverted on the corresponding webpage.
I put the code HERE
This circle, is generated by a postscript script!!

The text is drawn using constructions like this:
247 ux 160.65 uy moveto (GH6) show stroke
You need to add a pdfmark operation, the exact pdfmark you want to use depends on what you are trying to open, and where. If you want to open another PDF file you can use a Link Annotation with a GoToR action, if you want to open a web page you can use a Launch action or possibly a custom action, depending on what application is viewing the PDF file. I'm going to assume you want a Launch action.
The Launch pdfmark should look something like :
[/Rect [50 425 295 445] /Action /Launch /Border [0 0 2] /Color [.7 0 0] /URI (http://www.adobe.com) /Subtype /Link /ANN pdfmark
Obviously you need to calculate the Rect parameters so that clicking in the area of the text will launch the destination.
The way to do this is to use the PostScript path operators. First we need to save the current setup, then convert the text to a path, then calculate the bounding box of the path. Then we can use those co-ordinates for our Rect parameters.
Eg:
247 ux 160.65 uy moveto
(GH6)
dup % copy the string
gsave % save the current environament
exch % bring the string copy to the top of the stack
[ /Rect % Put a mark and name on stack
3 -1 roll % Bring string copy to top
true
charpath % create a path equivalent to drawing the text
flattenpath % flatten curves
pathbbox % get the bounding box
% we now have our box on the stack
% stack is: (GH6) [ /Rect llx lly urx ury
% So put the other parameters in place
/Action /Launch
/Border [0 0 2]
/Color [.7 0 0]
/URI (www.dummy.com)
/Subtype /Link
/Ann
pdfmark % and execute the pdfmark
grestore % put the graphics state back
show stroke
Some of the text is shown via a slightly different idiom:
241 ux 84.65 uy moveto (45.0) dup stringwidth pop 2 div neg 0 rmoveto show
you can do exactly the same as above, just put the dup...grestore construction after the rmoveto and before the show.
Caveat: I haven't tested this at all, but it should show you how to proceed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With