Highlighted

Is there a way to automatically convert links from "open a web link" to "open a file"?

Explorer ,
Jul 06, 2020

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.

TOPICS
Create PDFs, Edit and convert PDFs, How to, Print and prepress

Views

151

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Is there a way to automatically convert links from "open a web link" to "open a file"?

Explorer ,
Jul 06, 2020

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.

TOPICS
Create PDFs, Edit and convert PDFs, How to, Print and prepress

Views

152

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Jul 06, 2020 0
Adobe Community Professional ,
Jul 06, 2020

Copy link to clipboard

Copied

There is no such action in Adobe Acrobat.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 06, 2020 0
Most Valuable Participant ,
Jul 06, 2020

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 06, 2020 1
Adobe Community Professional ,
Jul 07, 2020

Copy link to clipboard

Copied

Does it have to be using Regex exclusively?

 

Adobe Acrobat can convert all hyperlinks automatically if:

 

  • You go to EDIT -->>PREFERENCES--->>GENERAL. In the Basic Tools section there's a tick-box "Create links from URL's"
  • NOTE: This works as long as the content of your document is entirely based on plain text. The content can't be encoded, nor be rendered text that was produced via OCR software and layered on top of a scanned image.
  • And the text string must be FreeType fonts and the URL type must also conform to this format "https://www.website.com" for example.
  • If the URLs are missig  that convention (or schema), such as missing the "www" portion  it may not detect the URLs and has to be done manually (alse evaluate what happens and how the link would behave if it detects that such links points to a local file)
  • If you don't have this setting enabled, then enable it it in the preferences and save the document and close Acrobat.
  • When you re-open the PDF in Acrobat you should notice, that even when the content appears as plain text, when the user hovers the mouse pointer over the URL text string, the mouse pointer will turn into the little hand pointing with index finger icon, and also a tooltip yellow banner will pop(visually indicating that TEXT/ HTML conversion tool place) and therefore, clicking on it will take you to that web page.

 

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:

 

automaticURL.png

 

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/')");
}
}
}

 

 

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 07, 2020 0
Adobe Community Professional ,
Jul 07, 2020

Copy link to clipboard

Copied

The OP wants file open links, not web links.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 07, 2020 0
Most Valuable Participant ,
Jul 07, 2020

Copy link to clipboard

Copied

Those are not even web-links, they are JS commands...

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 07, 2020 0
Adobe Community Professional ,
Jul 08, 2020

Copy link to clipboard

Copied

The OP want replace web links.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 08, 2020 0
Most Valuable Participant ,
Jul 07, 2020

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 07, 2020 0
Adobe Community Professional ,
Jul 07, 2020

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.  

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 07, 2020 0
Adobe Community Professional ,
Jul 07, 2020

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 07, 2020 0
Explorer ,
Jul 14, 2020

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.

 

jmyers2_0-1594732567765.png

 

 

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 14, 2020 0
Adobe Community Professional ,
Jul 14, 2020

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. 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 14, 2020 0
Community Beginner ,
Sep 11, 2020

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 11, 2020 0
ls_rbls LATEST
Adobe Community Professional ,
Sep 13, 2020

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:

 

links.png 

 

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 13, 2020 0