Settings Links to PDFs

Having been unable to use RW7 with Yosemite, I have reverted to an old Mac which ran RW6 well with OS 10.6.8. I am no longer able to set links to PDFs although I can do so to gifs. The resources show as OK. When I set links and go to view mode the screen is blank. If I ask it to open in a new window nothing happens. When I return to check the link setting the box is blank. I was unable to set links in RW7. Is this the same problem?

Don’t know about all that. I just serve up PDF’s by uploading them to my server and providing a link to it. The browser will handle the download. For many items that are truly download only (not to read online) I use a button linked to a very simple snippet of code to force download the file.

Hi Stuart,

Sorry you’re having problems.

Not sure if I understand what you’re saying here, you mentioned that you can’t get RW7 working with Yosemite (2014 - 10.10), but then you said you are run 10.6.8(Snow Leopard 2009).

If I remember RW7 should run fine on Yosemite (10.10).

As for the links to PDFs, without a bit more information it’s hard to say what might be going on with the site.
How did you add the PDFs to the site?
How did you add the link?
You said “view mode”, have you checked the links with a published page?
Screenshots would probably be helpful?

You might need to be patient as there probably aren’t many of us that still have RW6 installed so we’re working off our memory.

@1611mac Hi Greg,
Would you mind to share the snippet?

Thanks in advance

It’s so simple I’m almost embarrassed to. No error checking or anything. You can also find more robust scripts by searching “php force download” on web. Some get very detailed. We serve up hundreds of downloads a day. I’ve never had an issue with this ultra simple snippet, and also no user complaints. Though if something goes wrong there is no feedback for the user.

Just put the code in the same location (folder) as your pdf and then set the button url to the location and name of code. For example, code below could be named “force_hummingbird.php” - if in a “downloads” folder (along with the pdf itself) set your RW “Download” button url to https://mysite/downloads/force_hummingbird.php

Here’s the code:
<?php
header(‘Content-disposition: attachment; filename=Hummingbirds.pdf’);
header(‘Content-type: application/pdf’);
readfile(‘Hummingbirds.pdf’);
?>

Obviously you have a custom snippet for each pdf to download (with appropriate name.)

Hi Doug

RW7 gave me a number of problems, particularly setting links, which I know was a widespread issue. I do not want to go beyond Yosemite because of Adobe’s policies with CS. Thus, I have tried going back to an old Mac which has RW6, which ran well in the past. Although I can set links to gifs without problems, I am can no longer set links to PDF documents which I want to show on screen and be downloaded by viewers if required.

I am able to import the PDF documents to RW6 as resources, which show correctly if I click on them as resources. When I set links, however, and attempt to look at RW6 pages in view mode they do not show, just a blank window. If I set them to appear in new windows nothing happens at all.

If I check a link I have just set (it appears greyed), the box appears blank. I do not want to publish until I think I have it right.

I come at the low tech end of the market but have managed to make RW work happily in the past.

Stuart.

I know of no “widespread issue” with settings links with RW7.

There could be an issue with the old “view” mode in RW6 not showing the PDF correctly.

I’d probably try to publish to at least a test page and see if it works.

You could also publish to a local folder (if I remember in RW6 it was export in the file menu). If you’re not using PHP you could then try it out in a browser.

I personally would be hesitant to rely too much on the old resource folder in RW6 or RW7. Might be okay but it tended to have issues.

I would probably manage those resources externally of RapidWeaver with an ftp client like transmit or FileZilla.

In RapidWeaver 8 RealMac reworked the entire resource management and I wouldn’t hesitate to use it.

I thought folks were able to use The old Adobe CS stuff with Mojave. It’s Catalina not supporting 32bit that blocks it. I haven’t used Adobe stuff since shortly after going with the subscription modal. I’m not a heavy graphics user and found replacements for what Adobe Photoshop and InDesign did for me.

I think you are at or past the ”end of life” for the old Adobe CS stuff your using. So I’d take the time to find replacements or subscribe. Otherwise, you are going to be stuck in the past with all your other software.

Anyway, you need to test the pdf file outside of RW6’s View mode.

Hi Greg, it’s obvious that I’m doing something wrong. When I set the url to the code, the code is downloaded, not the .pdf
What do you suggest to do the snippet correctly?

Best

I think if I’m understanding it correctly, you put the code in a .php file in the same folder as the pdf and then set the URL to the location of that file. You don’t put the code in the URL.

@davehughes Thanks Dave, that is what I do.
My question is how to create the working .php file.

Best regards

Any text editor and just set the extension to .php I think

1 Like

As @davehughes said any text editor. Plain text.

1 Like

With only one add on stack and a simple link to a folder on your server…it works…



http://www.ibize.com/pdfdl/

I added .php extension to my page…
I compressed the pdf file to a zip to force a download and that is the simple link shown above and I used @joeworkman pdf embed…and no code at all.

The problem I have with delivering zip files is that some customers have no clue what they are or what to do with them and some systems are very old and not set to auto expand. We have a lot of older customers who are not computer literate so delivery of a pdf with a force download is a good way to go for us. It’s also very simple. With a working php script on the server I just duplicate it with a new name, change the name of the files to be delivered and save. Then just point the download button to the script. Literally just takes a few seconds.

Sorry if I come back with the same topic. To discover where my error is, I named a test .pdf document as Hummingbird.pdf, I uploaded the code file exactly as Greg @1611mac wrote it. Set my button to https://(my site) /wh/force_hummingbirds.php and when active it takes me to a blank page.
This is the error it generates:

Nov 16, 2019 02:09:03 UTC] PHP Parse error: syntax error, unexpected ‘:’, expecting ‘,’ or ‘)’ in /home/brimedne/public_html/wh/force_hummingbird.php on line 2
[16-Nov-2019 02:19:09 UTC] PHP Parse error: syntax error, unexpected ‘:’, expecting ‘,’ or ‘)’ in /home/brimedne/public_html/wh/force_hummingbird.php on line 2

The code Greg posted somehow converted to curly quotes. You’ll need to replace all the curly, single quotes with regular, straight, single quotes.

1 Like

What Don @DLH said is true. When Greg @1611mac posted the code on the forum, he didn’t mark it as code </>. The software this forum uses converts quotes to curly quotes.

Yes Don @DLH, that’s was the issue. Many thanks to all you for your help.

Best regards

My mistake for not posting the code as code. I should know better. Thanks @DLH and @teefers for the correction. I have curly quotes turned off even in Pages but I’m so used to using code editors I don’t even think about curly’s any more…

@peppermint - Did you get it working?

1 Like

Yes Greg @1611mac, working as expected :grinning::clap:

Many thanks