Hyperlink to PDF in same folder

Started by Gomez, November 08, 2017, 11:55:51 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Gomez

Hello,

I'm trying to add a hyperlink to a visio file which I later export as pdf.
The hyperlink points at a other pdf. Both pdfs are always in the same folder.

If I move both pdfs in a other folder the link still points at the old folder.

For example
When I create both files they are located at "c:/tmp".
File1 points at "c:/tmp/file2.pdf" (I have deactivated relative paths)

After i move both files they are located at "c:/visiofiles".
File1 still points at "c:/tmp/file2.pdf" (which not longer exists)

It should point at "c:/visiofiles/file2.pdf".

Is there a way to say point at "myfolder/file2.pdf" where myfolder is variable?

Surrogate


Gomez

Even if I use a relative hyperlink the created pdf trys to link to the old folder.

I export the file as pdf and than move it with the other pdf to a new folder.

Independent of the current location the hyperlink points at the old folder.

Surrogate

I misunderstood what you want. Relative path works only in Visio document !
When you convert visio document to pdf, this hyperlink became fixed hard link...

Hey Ken

Gomez:

   I save multiple hyperlinked Visio drawings as PDFs all the time, and I have not seen the behavior you mention.  But then I do something a bit odd to make it work.  (Odd?  Me??)

   Let's say we create a button that hyperlinks to another Visio document.  The creation looks just as Surrogate says above.  It works irrespective of folder for me as a relative hyperlink.  However, I put the button on a layer that does not print.  This is important.

   I then create a second button identical to the first, except it hyperlinks to the PDF.  Again, the creation looks just as Surrogate says.  Move that button to be exactly on top of the first button, and "Send to Back".

   What happens is that if you're in Visio and right click on the button, you get the relative Visio hyperlink.  But if you're in the PDF, the Visio button did not print and you only get the relative PDF hyperlink.  Not only does this work from my hard drive, it also works in SharePoint.

   Another suggestion is that there may also be something about how you save your PDF.  I use VBA, as follows:



ActiveDocument.ExportAsFixedFormat visFixedFormatPDF, _
    ActiveDocumentName, _
    visDocExIntentPrint, _
    visPrintAll, _
    IncludeDocumentProperties:=False, _
    IncludeStructureTags:=False  ' turns off floating "Sheet.1"



   Looking at the defaults for manually saving as a PDF, Include Document Properties is True, where my VBA sets it as False.  But I tried saving it manually with and without the flag, and it made no difference.  Both times I got a relative hyperlink.

   Another suggestion would be to look at the shapesheet of your hyperlinked shape.  In the hyperlink section, the Address cell should only have "YourFile.PDF", not "C:\whatever\YourFile.PDF".  Manually fixing the cell should do the trick.

   Another suggestion would be to change jobs.  (Just kidding!)

   Good luck!

   - Ken

Ken V. Krawchuk
Author
No Dogs on Mars - A Starship Story
http://astarshipstory.com

wapperdude

@Hey Ken:  not odd  :o,  brilliant!   :)

Wapperdude
Visio 2019 Pro

Gomez

@Hey Ken

Surrogate is right, in the shapesheet stand the relative path but in the pdf is the hard link.
I use the menu to export the visio file ("file/publish as pdf...").

I forgot to say that I use Visio 2007, perhaps they changed the pdf export in newer versions of the program.

Tomorrow I try to export the file via a macro, my VBA is not the best, but what should go wrong  ;D

Thanks for your help!

Hey Ken

Folks:

    My latest undertaking is going to involve a lot of cross-file hyperlinking distributed as a bunch of PDFs, so I'll be needing a lot of hyperlinked buttons as described above in this thread.  Since I'll be doing so many, laziness dictates that I invest the time in automating the creation of the overlapping buttons.  However, I ran into an interesting situation: On a grouped shape, not only do I need to set the group to a Never Print layer, I also have to set the layer on each shape within the group—but not always.  If I manually assign the group to the Never Print layer and check the "Preserve group member layers" checkbox, I need not set the layers on each grouped shape.  If I don't check it, the layer is not propagated to the grouped shapes.

    Here's the problem: If I turn on the macro recorder, it records exactly the same thing regardless of whether or not the checkbox is checked.  Is there any way I can get the same result in VBA as with manually checking the box?  Otherwise I'd need to get recursive to set the layers because one or more of the grouped shapes may itself be a group, perhaps containing its own grouped shapes, etc.  And what if the grouped shape contained a copy of itself?  The recursion would never end!

    Any suggestions?  I'm running Visio 2013 professional.


Gomez:

    Odd, but my PDFs do not have the hard links you describe.  They're always relative.  So when I create my cross-file hyperlink, it searches in the same folder for the linked file.  And as I mentioned, if I copy the PDFs to SharePoint, the links search the local SharePoint folder.  If I hover over the button in the PDF it does show a full path, but that path changes properly when I copy the PDF to any other location, so the links are definitely relative.  I run Visio 2002 and 2003 at home and have not noticed the problem you describe.  No idea why you're having the problem.  Did you ever try your suggestion to use VBA to save the PDF?  I've noticed other problems introduced by the manual save PDF process (such as when .PNGs are on top – the background changes from transparent to black). 


Wapperdude:

    You make me blush!

    - Ken

Ken V. Krawchuk
Author
No Dogs on Mars - A Starship Story
http://astarshipstory.com