Copy link to clipboard
Copied
We create web links in a document in FrameMaker, and then save the FM document to PDF. After opening the file in Acrobat, we have to change all the "open a web link" hyperlinks to "open a file." (FrameMaker's open a file option only allows for other FM documents.) I was hoping to find an action we could run in Acrobat that uses regex to find and change the links rather than doing each one manually. Is such a thing possible? Thank you.
Copy link to clipboard
Copied
There is no such action in Adobe Acrobat.
Copy link to clipboard
Copied
It's not possible within Acrobat to automate it (maybe with a plugin...), but it is with a standalone tool.
I've developed similar tools for my clients in the past and will be happy to create one for you, too. You can contact me privately via [try6767 at gmail.com] to discuss it further, including the price.
Copy link to clipboard
Copied
Does it have to be using Regex exclusively?
Adobe Acrobat can convert all hyperlinks automatically if:
With those notes in mind, I have to ask, Are you saying that if you have this preference setting enabled it doesn't convert the hyperlinks automaticaly when you open the document in Acrobat?
In my slide below, I just copied this part of my conversion as text using the Edit PDF tool, or just by right-clickng on tmy document and selecting "Edit Text" or "Edit Text & Images". After pasting my text selection, I saved the PDF and closed Acrobat.
The slide below shows the final result after I reopened the document. Hovering the mouse pointer over that string of text reveals that it is now a URL:
In addition, if I were you, instead of saving from FrameMaker to PDF directly, I would rather save your FrameMaker documents to something like Postscript format.
Then open that Postscript file in Adobe Acrobat so it can convert it automatically to PDF and see if in the process of doing this it automatically converts those strings of text to URL automatically.
Say, if this works for you, then yes, you can create a javascript action (not using Regex, of course) using a for loop to get all the URLs in the document and change their appearance; or even play around with the scripting to set the launching action of all the URLs found.
See Example 2 for "addLink" of the Adobe Acrobat SDK JavaScript API Reference, Doc methods, page 232
for (var p = 0; p < this.numPages; p++)
{
var numWords = this.getPageNumWords(p);
for (var i=0; i<numWords; i++)
{
var ckWord = this.getPageNthWord(p, i, true);
if ( ckWord == "Acrobat")
{
var q = this.getPageNthWordQuads(p, i);
// Convert quads in default user space to rotated
// User space used by Links.
m = (new Matrix2D).fromRotated(this,p);
mInv = m.invert()
r = mInv.transform(q)
r=r.toString()
r = r.split(",");
l = addLink(p, [r[4], r[5], r[2], r[3]]);
l.borderColor = color.red;
l.borderWidth = 1;
l.setAction("this.getURL('http://www.example.com/')");
}
}
}
Copy link to clipboard
Copied
The OP wants file open links, not web links.
Copy link to clipboard
Copied
Those are not even web-links, they are JS commands...
Copy link to clipboard
Copied
The OP want replace web links.
Copy link to clipboard
Copied
As mentioned, this will not create file-open links. Also, getURL converts a web-page to a PDF, not open it, which won't work outside of Acrobat. You need to use app.launchURL, instead.
Copy link to clipboard
Copied
I should've changed that that example code, my apologies. I didn't mean to suggest it to be used verbatim. Thanks for clarifying.
I was trying to provide like an example template for the user that could be filled in and modified with their own script to accomplish that.
Copy link to clipboard
Copied
Please disregard the script that I posted above as an example.
This what I was trying to provide : addWeblinks
Taken from the Adobe Acrobat SDK JavaScript API Reference, Doc methods , page 239
"Search the entire document and convert all content that appears to be a web address into a web link. Report back the number of links created"
var numWeblinks = this.addWeblinks();
console.println("There were " + numWeblinks +
" instances of text that looked like a web address,"
+" and converted as such.");
An array or for loop script is not needed to use this as an action, I apologize once more if my reply caused confusion.
Copy link to clipboard
Copied
I'm sorry, the terms I used in my original post may have been confusing. We produce a document in FrameMaker which has web links to other documents. We then create PDF and HTML files from the FM file. (For the PDF, we print to post script.) Once the PDF has been created, we have to change many of the weblinks to open-a-file links. In the example below from the PDF version of this publication, the blue words "Scientific objectives" need to open the PDF file for that chapter.
Copy link to clipboard
Copied
A lot of users don't like what I am going to suggest, but in your particular case, the quickest workaround is to save from Frame Maker to a .docx (MS Word) file format.
This will(or should) retain all the links using this export method.
Then open the .docx file directly in Acrobat and it will handle the import to PDF automatically.
I recommended this suggestion for another user in a different thread because when he was exporting to postscript from a barcoded PDF manual that he was scanning with his mobile device. The issue was that in doing so, all the content of the resulting poscripted file was flattened, including the weblinks.
Moreover, if you employ JavaScript to develop an action script that, let's say, it can count and identify all words in that document that are not black color, for example, that still would require manual intervention to convert those phrases or words to a weblink, in which case, if you prefer to go this route I woul strongly encourage you to contact Try67 and have him develop a customized plugin tool just for this purpose.
I'm pretty sure you won't be dissapointed with his work.
Copy link to clipboard
Copied
It will not help to convert to Word. Converting from Word to pdf (Word 365 using Acrobat Standard DC, in my case) results in all links to files in the Word document (\\servername\share name\folder name\file name) being converted to web links. It is then necessary to go into the pdf file and convert each link individually. Further, it questions every time whether to open the file. Every time, even opening the same file a moment later after telling it to remember my preference.
Perhaps there is a script that will convert the links properly, but it should not be necessary. It's not as if this is freeware and we have to accept some bugs as the price. Older versions of Acrobat did this conversion correctly. I have posted this in other discussions, and while I have received several suggestions, nothing useful so far.
Copy link to clipboard
Copied
Adobe Acrobat Pro has two preferencen settings that create links from URLs automatically.
The first I would check is "Edit" --->>> "Preferences" --->>> "General" -->>> uncheck "Create links from URLs".
The other settings is also in Preferences--->>> "Convert to PDF".
See slide below and verify if by disabling that setting is actually the workaround you're looking for:
Copy link to clipboard
Copied
All this does is remove the links entirely. We need the links to open as a file, not in the web