Relative file links not saving in pdf?

Everything related to our flagship word processor.
Post Reply
Vanceone
Posts: 216
Joined: 2013-05-03 07:06:31

Relative file links not saving in pdf?

Post by Vanceone »

So I have a nice Nisus file, originally created in Nisus. I've successfully linked to some other files, pdf's to be exact, using the hyperlink->link to file command. I've used the relative path option. Now, when you move the Nisus file and the associated linked files around, preserving the structure, the file stays relative linked.

As soon as you save as PDF, however, it appears to be inserting an absolute link in each file hyperlink. This kind of defeats the purpose of saving a relative link.

Try it. Throw a Nisus file into a folder with a few pdfs. Link to those pdf's in your nisus file. Save a PDF of the nisus file. The links work in the PDF. Rename the enclosing folder. The links work in Nisus... but the PDF throws an error when you click on the link.

Is there something I'm missing? How can I have a relative link in my PDFs?

Oh yes, running Mavericks and Nisus 2.0.7
Vanceone
Posts: 216
Joined: 2013-05-03 07:06:31

Re: Relative file links not saving in pdf?

Post by Vanceone »

I've updated to the new Nisus 2.1. This problem still remains; and I'm getting a "There is no application set to open the URL "(and then it gives the url in url encoded format). This error makes PDF's really fragile when it comes to links. What can I do, if anything?

Trying to edit the links by hand in a PDF editing app doesn't seem to work, or at least I can't make it so.

Also, now that Nisus is sandboxed, it apparently is encoding sandbox code into the PDF link, as the error when you rename a folder includes a url that has about 200 characters of an applescript sandbox code.
User avatar
martin
Official Nisus Person
Posts: 5230
Joined: 2002-07-11 17:14:10
Location: San Diego, CA
Contact:

Re: Relative file links not saving in pdf?

Post by martin »

Unfortunately relative links / URLs do not seem to be correctly encoded in PDF data. At least, not at the level NWP is using to generate the PDF data using Apple's APIs. That is why NWP always converts the link target to an absolute path during export.
Vanceone wrote:I'm getting a "There is no application set to open the URL "(and then it gives the url in url encoded format). This error makes PDF's really fragile when it comes to links.
...
Also, now that Nisus is sandboxed, it apparently is encoding sandbox code into the PDF link, as the error when you rename a folder includes a url that has about 200 characters of an applescript sandbox code.
This is unexpected. Can you please verify the problem persists if you add a fresh link using the command Insert > Hyperlink > Add Link To File? It may be that the problem only occurs for links that were added before Pro 2.1.

Links to files that are added with Pro 2.1 will track the target using aliases/bookmarks, so that the link remains valid even if the original is moved or renamed. However, when you export the PDF the link's target will be encoded as a hardcoded path that no longer does such tracking. I realize that's probably not the behavior you want either, since it also doesn't allow using relative links.
Vanceone
Posts: 216
Joined: 2013-05-03 07:06:31

Re: Relative file links not saving in pdf?

Post by Vanceone »

I realize this is wonky; In fact it appears that relative links in PDF's is, to quote Steve Jobs, "a big ball of hurt." Nothing seems to handle them well, except possibly Acrobat itself (but who has that kind of cash to drop on that?)

I deleted all my links and started over; the errors don't appear to crop up. Here is how I worked around my problem. What I needed to do was create a pdf that linked to companion documents when clicked on, and burn it to a CD (thus explaining my need for a relative link; as burning a hard coded CD makes the static links worthless.)

Since this has to be Windows compatible, I went into disk utility and created a CD disk image in FAT format, and mounted it. I copied my nisus document and the supporting documents onto the root of that FAT volume. Opening that Nisus document, I then went through and relinked my files to the version on the disk image. Here's the possible bug I've found: if I export to a PDF on that FAT file image, no hyperlinks at all work. Table of Contents, Indexes, etc--none of them work in that pdf. If I save that same PDF to my desktop and copy it to the disk image, it works. Links open the file on the disk image. So I made it work, but man, it's been a struggle. Not sure what Nisus can do, short of building in a direct PDF link tool and edit the GoToR or launch records itself (and I'm pretty sure that that particular function is not high on the roadmap.)

So I've not solved relative links, but I did solve it for my situation. Maybe I should build a PDF link tool that can fix this kind of thing....

Oh yes. Could we please have a feature where we can select some text (say, all the occurrences of a citation) and insert a hyperlink to the same destination for all of those selections simultaneously? I trust Nisus's find more than my eyes to not miss a citation.
User avatar
phspaelti
Posts: 1356
Joined: 2007-02-07 00:58:12
Location: Japan

Re: Relative file links not saving in pdf?

Post by phspaelti »

Vanceone wrote:Could we please have a feature where we can select some text (say, all the occurrences of a citation) and insert a hyperlink to the same destination for all of those selections simultaneously? I trust Nisus's find more than my eyes to not miss a citation.
This is easy to achieve via macro. It requires just two lines:

Code: Select all

$link = Link.newWithFilePath $file
$link.apply
Below I attach a (barebones) macro, which asks you for a link and then applies it to all the selected bits.
Insert Multiple Links.nwm
(4.72 KiB) Downloaded 471 times
philip
User avatar
martin
Official Nisus Person
Posts: 5230
Joined: 2002-07-11 17:14:10
Location: San Diego, CA
Contact:

Re: Relative file links not saving in pdf?

Post by martin »

Vanceone wrote:I realize this is wonky; In fact it appears that relative links in PDF's is, to quote Steve Jobs, "a big ball of hurt." Nothing seems to handle them well, except possibly Acrobat itself (but who has that kind of cash to drop on that?)
I feel NWP does a very nice job with PDF features like intra-document linking, TOCs, etc, so I'm very sorry that NWP let you down in this situation with relative links. I spent some time trying to workaround the problem with relative links in Apple's PDF generation APIs, a while back, but I didn't have any success.

I'll add your vote to our issue tracker for this, but I can't make any promises. If other users want relative linking in generated PDFs, please speak up. If more users are interested, naturally it's easier to justify spending the time investigating a feature that may or may not be feasible.

Well, I'm glad you were able to push through and found a solution for your particular situation.
User avatar
martin
Official Nisus Person
Posts: 5230
Joined: 2002-07-11 17:14:10
Location: San Diego, CA
Contact:

Re: Relative file links not saving in pdf?

Post by martin »

Vanceone wrote:Oh yes. Could we please have a feature where we can select some text (say, all the occurrences of a citation) and insert a hyperlink to the same destination for all of those selections simultaneously? I trust Nisus's find more than my eyes to not miss a citation.
I actually consider it a misbehavior that you can't already do this. You should be able to create a multi-part selection (eg: using Find All), use one of the commands on the menu Insert > Hyperlink, and have all the selected text acquire the applied link. In fact, it works for Add Link to File and Add Link to Bookmark, it just fails for Add Link. I'll file a bug report, thank you.
NisusUser
Posts: 335
Joined: 2011-01-12 05:32:38

Re: Relative file links not saving in pdf?

Post by NisusUser »

martin wrote: If other users want relative linking in generated PDFs, please speak up.
+1
User avatar
martin
Official Nisus Person
Posts: 5230
Joined: 2002-07-11 17:14:10
Location: San Diego, CA
Contact:

Re: Relative file links not saving in pdf?

Post by martin »

Thank you– noted!
Vanceone
Posts: 216
Joined: 2013-05-03 07:06:31

Re: Relative file links not saving in pdf?

Post by Vanceone »

Can we get something on this in 2.1.1?

I had to open another copy of Nisus on a different drive to save my document with file links as a PDF. My approach that I detailed that I thought had solved this turned out to not work; the links had embedded Applescript sandboxing code in them. As it stands, I believe file links cannot be saved in PDF's with any sort of reliability, or at least any sort of portability. Unless you are making a PDF for your own amusement and never move it, email it, etc. once created; it is pointless to use a file hyperlink for PDF's right now in 2.1.

This error totally ruins my main workflow in Nisus, which is writing documents, saving them as a PDF and providing them to the Court. Nisus's handling of many features that the Courts like is better than Words (and after all, Word has issues with links in PDF's too, so this isn't an exclusively Nisus problem), but if this isn't corrected I either have to find another Word Processor or be stuck on 2.07 forever.

To be honest, though, I'm not sure how this can be fixed due to the sandboxing requirement; I believe that is the main culprit here. Of course, relative links would be fantastic too.
User avatar
martin
Official Nisus Person
Posts: 5230
Joined: 2002-07-11 17:14:10
Location: San Diego, CA
Contact:

Re: Relative file links not saving in pdf?

Post by martin »

Vanceone wrote:Can we get something on this in 2.1.1?

I had to open another copy of Nisus on a different drive to save my document with file links as a PDF. My approach that I detailed that I thought had solved this turned out to not work; the links had embedded Applescript sandboxing code in them.
Your exported PDFs should not have any sandboxing security authorizations/code in the target file path or query string. Could you attach an example document? It would help to have both the RTF and PDF output. You could also send us these example files privately via the menu Help > Send Feedback. Thanks!
Vanceone
Posts: 216
Joined: 2013-05-03 07:06:31

Re: Relative file links not saving in pdf?

Post by Vanceone »

So I sent some files for your perusal.

I hope you can reproduce the bug. It's quite annoying!
User avatar
martin
Official Nisus Person
Posts: 5230
Joined: 2002-07-11 17:14:10
Location: San Diego, CA
Contact:

Re: Relative file links not saving in pdf?

Post by martin »

Thank you for the submission, we'll take a look and get back to you on reproducing the problem.
Post Reply