Skip to main content
Fadhel
Participant
January 15, 2016
Question

batch changing relative links to absolute links

  • January 15, 2016
  • 2 replies
  • 1262 views

Hello All,

I have a substantial amount of PDF files (around 50,000) that link to other PDF files. Now, that used to work fine before NPAPI is disabled on most browser, and portable devices do not allow this kind of links. I am looking to batch change those relative links (../folder/subfolder/file.pdf) to a full URL (http://www.mysite.com/pdfdocs/law/../folder/subfolder/file.pdf). [I am just appending the full URL to the actual relative Path).

Is there a way to automatically achieve this (Batch process)?

I tried using regular expressions on files to change the

xxx 0 obj<</F(../folder/subfolder/file.pdf)/Type/Filespec>>

endobj

to

xxx 0 obj <</URI(http://www.mysite.com/pdfdocs/law/../folder/subfolder/file.pdf)/S/URI>>

endobj

but it turned out not to be that simple. there's so many different ways a file is referenced inside an object(not alway /F inside an single object), also the clickable area wouldn't directly reference the file, but it references another object that references the file object (if that makes sense)

Any help would be much appreciated.

Thanks a lot.

This topic has been closed for replies.

2 replies

Inspiring
November 1, 2016

try67
Community Expert
Community Expert
January 15, 2016

No, it's not a simple task at all, and it can't be done in Acrobat with a script or an Action (maybe with a plugin).

I have developed a stand-alone tool that allows you to do it, though. You can purchase it from here (there's also a free demo version you can try out first):

Custom-made Adobe Scripts: Batch Edit URL Links in PDF Files

Fadhel
FadhelAuthor
Participant
January 15, 2016

Hi Try67,

This looks promising, but from the details I can se in your blog page, it doesn't do what I exactly need.

I see that you need to provide the search term then either replace or append to it. What I am trying to do is for the script to automatically find every single link to a file and make it a url and prepend a URI to it.

It looks like I need to run another tool to extract all the file links into a csv file, modify the csv file to make it compatible with your script, then run your script. (would my assumption be right here?)

I will give it a try and let you know.

Thanks,

try67
Community Expert
Community Expert
January 15, 2016

I see what you mean. It's possible, but it's not as simple as you think. Links to files and links to web-pages are of a different type.

It's not just a question of editing the destination, the link's type will also have to be adjusted as well.

Send me an email or a PM if you want to discuss it further, please.