Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XFRX - Hyperlinks to local files - Anyone done this?

Status
Not open for further replies.

GriffMG

Programmer
Mar 4, 2002
6,288
1
38
FR
I have been asked to supply a copy of the attachment data from one of my systems.
All the attachments remain in the file system, organised by originator.

In this instance there are probably something like half a million files - amounting to 60GB of data.

I would like to supply some of the meta data relating to the files in a VFP report, so that would have the
originators name, the title, the number and the revision of each document, and a list of the files related to it.

So far that all exists... I would like the report presented as a PDF on a drive along with the actual files and for the
recipient to be able to open the PDF, search for the title or whatever, click on the file name and have the file open (mostly they are PDFs too).

I use XFRX to create the PDF and I've been able to open a hyperlink to a web page, but not a local file... it might be a security restriction?

Is this doable?

I could write a VFP app to do it, or perhaps do it in an excel file... but the pdf approach seems very open and pretty universal?

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.
 
Griff,

Let me check that I have understood this. You are happy that you can create the PDFs. The PDFs are stored somewhere on your local or network file system (that is, not on a web server). And you want to provide a facility whereby your users can click on something within your application to open a given PDF on the screen. Is all that correct?

If so, why not simply create a label or button and place it on a form. In the click event, write code to ShellExecute() the PDF. The code would have to know where the PDF was stored, but wouldn't need to know which PDF reader the user has installed.

I've got something very similar in one my own applications: a form for searching and viewing archived invoices, which are all stored as PDFs.

Apologies if I've misunderstood the requirement.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
I can do that Mike, I want to hand over the files and a pdf with links in it that will open the relevant file from a structure under where the pdf is located.

This is just a nice to have - I'm only really required to supply the files, but with there being so many it seems 'a nice thing to do'.

I would prefer not to use an app, because I don't know what OS the recipient may have, Apple, Android or Windows.

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.
 
Sorry, Griff. I should have read your post more carefully. You are saying that you want to create a PDF which itself contains embedded links to the actual PDFs that the user will view. I can see the benefit of that. If nothing else, as you say, it would be OS-independent.

It's easy enough to embed the links into the main PDF. As far as XFRX is concerned, they would just be bits of text in your report file. Given that the targets of the links are in your local file system, the format would be something like this:

[tt]file:///C:/MyPDFFolder/MyPDF.PDF[/tt]

But whether the user will be able to follow the link to open the PDF is another matter. I would think that would depend on the PDF viewer they are using. The only viewer I have on my system to experiment with at the moment is Sumatra, and while that recognises the link for what it is, it doesn't seem to respond to being clicked, as far as I can see. Other PDF viewers might work differently.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Hi

This might be unusual, me making a suggestion to you, not deferring to your greater experience...

If you have a VFP report and take any text item (generally a field in a text box) and edit the 'other' property
there is a Comment section, XFRX reads the contents of this field and (their example) if you put this in it:

Code:
#UR A HREF="[URL unfurl="true"]http://www.eqeus.com"[/URL]

Then clicking on that field in the PDF of the report will result in the default browser opening that site!

I have tried a few combinations of "file:" but can't seem to make it work for a local file though. I think it is a security thing.

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.
 
The major downside of file links is they won't work relative. A PDF reader is no browser, therefore you also have no current Document.location.href which would be the basis for relative links.

You may find a solution on the basis of Word documents linking to others (relative) and then finally saving as PDF this Word feature may remain intact.

Bye, Olaf.

Olaf Doschke Software Engineering
 
Griff, try pasting the [tt]file:///[/tt] link into your browser's address bar. Does that open the PDF successfully (it does for me)? I know that's not what you want to achieve, but at least it will tell you if there is a security issue involved.

Also, when you open the PDF (the one containing the link), does the link appear in blue and underlined (it does for me)? If so, that indicates that XFRX is successfully inserting the link, and the PDF viewer successfully recognises it. But it does not necessarily mean that you can follow the link by clicking on it. That might be down to a setting in the viewer, or you might need to do something like CTRL+Click (like you do in Word). But none of that works for me (using Sumatra as my viewer).

I also tried Olaf's suggestion. I created a Word document containing the link, and saved it as a PDF. Word was able to follow the link, but the viewer wasn't.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
You are getting much the same results as me, I think it's a security feature in XFRX - designed to stop you from making PDF files that can read other local files.

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.
 
I might be wrong, but I can't see why XFRX would impose that restriction. What's more, if you were to manually type the link into a Word document and save that as a PDF, wouldn't you get the same result? And also if you type it into a plain text file and "print" it to a PDF driver. Which suggests that it is not XFRX that is causing the problem.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
I don't know why you're thinking a file link is a security risk or reads a file. The PDF containing a link only has that link. At most just a file location and name is revealed.

Bye, Olaf.

Olaf Doschke Software Engineering
 
Hi Olaf

*I'm* not saying it *is* a security risk, just that it might be a perceived one. I know that browsers weren't able to have predefined file names in the input type FILE for example and you couldn't determine a files size from the browser (not the case any more) maybe the PDF definition does something similar?

It might be an oversight.. not terribly VFP related either (sorry) bar the XFRX element

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.
 
Griff,

The obvious way of ruling XFRX out of the equation (or ruling it in) would be to create a PDF by some other means, for example, by saving a document as PDF in Word or Excel, or printing a document to a PDF driver. Place a link within the document, and see if it works in your PDF viewer. That would at least let you eliminate PDF as a possible source of the problem.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Good thought, worth two minutes work, I have a PDF editor I'll see what that can do

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.
 
Tested, works in PDF - in as much as it accepts links to files and can store them with relative paths, and my viewer can get to the files...

I will email eques.com

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.
 
That's interesting. Let us know if you get a response.

In the meantime, here is another thought. Why not ditch the PDF completely, and use HTML instead? I'm referring here to the "main" document: the one that contains the links to the actual files that the user wants to open.

I understand that you want to design an interface that is OS-independent, which therefore rules out doing that part of it in VFP. That's fine. So here's what I am suggesting:

In your VFP app, generate an HTML page in which the target filenames are formatted as [tt]file:///[/tt] links (to the PDF files on the user's local system). This page would be just an ordinary text file. It can contain whatever text and formatting you like. You don't need to be an HTML guru to do this; just generate basic <p> and <a> tags; it doesn't have to pass any sort of validation. Send this file to the user in some way.

The user then opens the HTML file in their browser. You don't need to write any code for that. Just let them double-click on the file in Windows Explorer or their desktop or whatever. The fact of it having an .HTML extension will tell the OS how to open it. Within the browser, the user can then click on the links in the normal way. The target PDF will open either in the user's preferred PDF viewer, or in the browser itself, depending on the browser settings.

The whole thing would be done in the user's local system. There is no web connection necessary, and so none of the usual security issues would be involved.

If you get a good reply from Eqeus, that's fine. But if not, give this idea a shot.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
I got a response, it took them just twenty minutes to reply!

I'm using version 12 from 2008, and they added support for this in version 17.1, they are now on 19.1

Just deciding if it is worth upgrading... which version do you have Mike?


Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.
 
I'm also still on ver. 12. I haven't seen any reason to upgrade. But I have never had this requirement to link to PDFs. (In the application I mentioned above, the links are done with normal VFP controls within a form.)

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
That's exactly where I am, did know of a couple of bugs/features but never thought it worthwhile upgrading.

Right now, I am tempted to do so... 12 years between versions is pretty good value! I've asked if they still do a pdf only version (which is what I have).


Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.
 
Asked for an upgrade price for PDF only...
Purchased upgrade - $149
Awaiting delivery


Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top