Help with relative path in hyperlink

Ask here any questions regarding program functionality
User avatar
JG
Posts: 4599
Joined: Wed Jun 04, 2008 8:34 pm

Re: Help with relative path in hyperlink

Post by JG »

Everything else plays wonderfully, just PDF's are the issue.
So if you link to a txt file, will it open in your default text editor?
If so, is it just that pdf extension just does not have an association with a pdf reader. So what happens if you double click the pdf file? does it launch?
Jon
the
Word 6 Bible Software
OS for testing; Windows 10
Beta Download ------Beta Setup Guide------On-line Manual------Tech doc's and Utilities------Copyright Factsheet
DarrelW
Posts: 1259
Joined: Fri Sep 11, 2009 1:04 am
Location: Klamath Falls, Oregon
Contact:

Re: Help with relative path in hyperlink

Post by DarrelW »

Hi Jon,
1. The PDF file works fine if I double-click and open it outside of TW
2. I install multiple PDF viewers and associated each one individually, then tried opening the PDF from TW and each did nothing
3. I created a simple text file with .txt extension, hyperlinked to that file and it opens fine from within TW

I used a full path for each hyperlink. The text and PDF files were both in the Books folder.

So the problem appears to be handshaking, passing control from TW to the PDF viewer. I use Gedit as the text editor and TW passes control to it beautifully.

Do any of you have any ideas? Thanks

Darrel
DarrelW
Posts: 1259
Joined: Fri Sep 11, 2009 1:04 am
Location: Klamath Falls, Oregon
Contact:

Re: Help with relative path in hyperlink

Post by DarrelW »

I also can hyperlink html files and they work nice. I cannot hyperlink .doc, .rtf or .odt files. Nothing happens.
csterg
Site Admin
Posts: 8627
Joined: Tue Aug 29, 2006 3:09 pm
Location: Corfu, Greece
Contact:

Re: Help with relative path in hyperlink

Post by csterg »

Hm, i don't really know. If you can hyperlink html files, then maybe it's a fault of wine: the mechanism it has to launch pdf files fails
therapon
Posts: 335
Joined: Thu Jul 26, 2007 9:39 pm

Re: Help with relative path in hyperlink

Post by therapon »

WINE needs file associations set for various types. From the WINE wiki:
The example below uses winebrowser to launch the default PDF handler on your system (on a Unix desktop it uses xdg-open). Save the lines below to a file pdf.reg.

[HKEY_CLASSES_ROOT\.pdf]
@="PDFfile"
"Content Type"="application/pdf"
[HKEY_CLASSES_ROOT\PDFfile\Shell\Open\command]
@="winebrowser \"%1\""

Import the .reg file into the registry using the command

regedit $HOME/pdf.reg

from https://wiki.winehq.org/FAQ#How_do_I_as ... in_Wine.3F
This works in TW for pdfs using the native linux application to open them (okular for me). It also works to set associations for other types of files, e.g. odt files. Just change each occurrence of PDF or pdf to ODT or odt in the example, then import into the registry.
DarrelW
Posts: 1259
Joined: Fri Sep 11, 2009 1:04 am
Location: Klamath Falls, Oregon
Contact:

Re: Help with relative path in hyperlink

Post by DarrelW »

Hello Therapon,
I am just a little confused! If I have a pdf "Robertson-Greek Grammar.pdf" as an example, what am I changing in pdf.reg? I have installed Okular, so everything should be same as your system. I appreciate your help!

Darrel
therapon
Posts: 335
Joined: Thu Jul 26, 2007 9:39 pm

Re: Help with relative path in hyperlink

Post by therapon »

The hyperlink in TW should have the path to the pdf you want to open. Since txt files work properly, I would expect the same format for the link to work for pdf's.

Having said that, WINE needs to know what to do when you try to open a file with a particular extension. It's the same basic function as File Associations in Windows. There is a section in the registry that handles FileOpen based on the extension. Unless you have installed a pdf reader and word processor in WINE, there will be no associations for pdf, rtf, odt, doc, etc. files. They need to be added. The pdf.reg file adds a file association to the WINE registry for pdf's. In essence, it tells WINE to open a pdf with whatever application is the default in Linux. To make hyperlinks to pdf's work properly in TW, use a text editor to save the five lines in the example to a file in /home/darrel/ Then in a terminal, execute the command regedit $HOME/pdf.reg At that point, pdf hyperlinks should work in TW, opening the linked file in Okular.

If you want or need hyperlinks to rtf, odt, doc, etc. files to work in WINE, then repeat the process for each file type. For example, change every occurrence of pdf in the .reg file to rtf, save as rtf.reg, then import it into the registry.

therapon
DarrelW
Posts: 1259
Joined: Fri Sep 11, 2009 1:04 am
Location: Klamath Falls, Oregon
Contact:

Re: Help with relative path in hyperlink

Post by DarrelW »

Hello Therapon and Costas and Jon,
Therapon, what you suggested in the last post worked beautifully. I now have PDFs displaying beautifully in Wine from TW. I use the full path and the files display with no problem. I can also display .doc, .rtf, .docx, .odt files. Thank you all for your help!

Now an interesting "problem" is showing. My PDF folder resides under Books:
"/home/darrel/.wine/drive_c/Program Files (x86)/theWord/Books/".

If I use the following full path the module displays in my Linux PDF viewer:
"/home/darrel/.wine/drive_c/Program Files (x86)/theWord/Books/PDFs/Schmidt.pdf"

But if I use a relative path nothing displays:
"Books\\..\\Schmidt.pdf"

I can change the relative path to:
"Books//..//Schmidt.pdf"

and still nothing displays. I can go back to the full path and it displays beautifully.

But if I do the same with another test PDF it does display:
"Books\\..\\test.pdf"

I can change the relative path to:
"Books//..//test.pdf"

and it displays the PDF file.

Is there something I am not understanding about the relative path vs full path, something I have wrong syntactically?

Darrel
csterg
Site Admin
Posts: 8627
Joined: Tue Aug 29, 2006 3:09 pm
Location: Corfu, Greece
Contact:

Re: Help with relative path in hyperlink

Post by csterg »

use single forward slashes.
DarrelW
Posts: 1259
Joined: Fri Sep 11, 2009 1:04 am
Location: Klamath Falls, Oregon
Contact:

Re: Help with relative path in hyperlink

Post by DarrelW »

Thanks for getting back Costas. What is working for relative links is "Books//PDFs//Short Greek Grammar.pdf". By preceding any of my PDFs in the PDFs folder with "Books//PDFs//" the PDF shows in the Linux PDF viewer I am using. The only other linkage that worked is the full path. I tried every other combination I could think of and the only thing that consistently worked was "Books//PDFs//". MP3s played with "MP3//" (since MP3 is a folder at the same level as Books). My phrase diagramming PDF files as "Books//Diagramming//".

All of this started when I found Biblearc.com and their free arc, phrase and sentence diagramming tool. You can donate $3.95 a month if you want the ability to save your diagrams, or you can create them and save as either PDF or image and then pull them into TW and build a commentary of diagrammed verses! I chose the latter and now that I have PDF displaying working it is awesome! (I had to attach the image file since I couldn't figure out how to attach a pdf!)

Darrel
Attachments
1Th 1.2-5.png
1Th 1.2-5.png (89.32 KiB) Viewed 3605 times
DarrelW
Posts: 1259
Joined: Fri Sep 11, 2009 1:04 am
Location: Klamath Falls, Oregon
Contact:

Re: Help with relative path in hyperlink

Post by DarrelW »

Well, I have a problem. I cannot display PDF files in wine! I can display them in PlayOnLinux and CrossOver. A little background-I am running Linux Mint 21.1, Wine 8.0, I am running the latest TW beta, have ran pdf.reg. But I appear to be missing something. I had everything working 5 years ago by following all the above posts. I have gone back over those posts and tried everything, but to no avail! Does anyone have any suggestions?
therapon
Posts: 335
Joined: Thu Jul 26, 2007 9:39 pm

Re: Help with relative path in hyperlink

Post by therapon »

I haven't tried displaying pdf's with WINE but I have had perhaps a related issue in theWord: inability to preview or print anything at all. It is actually an issue for me in all apps running in WINE. What worked for me was to revert back to WINE v7.5.

therapon
DarrelW
Posts: 1259
Joined: Fri Sep 11, 2009 1:04 am
Location: Klamath Falls, Oregon
Contact:

Re: Help with relative path in hyperlink

Post by DarrelW »

I did revert back to 6.03, but still cannot display pdf files. I can display them in PlayOnLinux and CrossOver. And printing has never been an issue for me. The frustrating part for me is this worked for me 5 years ago, and I don't know what I changed on my system to affect it!
DarrelW
Posts: 1259
Joined: Fri Sep 11, 2009 1:04 am
Location: Klamath Falls, Oregon
Contact:

Re: Help with relative path in hyperlink

Post by DarrelW »

Well, I think I found my problem. When I had reinstalled TW apparently I installed it as a 64-bit install, so I reinstalled as a 32-bit app and now I can display pdf files! Must be an "age" thing on my side! :oops:
Post Reply