Page 1 of 1

Hyperlink on a PDF

Posted: Thu Apr 25, 2024 8:41 am
by Terkelsen
Is there an automated way of adding a hyperlink that will work if you click anywhere on a PDF?

I have a PDF and a corresponding XML coming in. The XML contains a URL. I need to ad that URL to the PDF, so that it will work if you click anywhere on the PDF.

I can do this manually in Acrobat by adding a button with no fill and no stroke. Resize the button to the size of the entire PDF, and set the action of the button to open a weblink.

...but is there a way to automate this?

Re: Hyperlink on a PDF

Posted: Thu Apr 25, 2024 9:32 am
by JimmyHartington
I use the cpdf https://www.coherentpdf.com command-line (is free, but needs license to be used commercially) for some tasks.

It seem from the manual that you can set annotations in a pdf from a JSON-file.

So I think you could make a pdf manually in Acrobat with a link. Extract the information about annotations with cpdf.
Then you have a JSON-file you can use as a template to create the annotation dynamically and add it with cpdf.

Image