Forums / Installing on a Linux/Unix Server / Working With Pdf's

Working With Pdf's

Results 1 to 5 of 5
18 Nov 2020, 12:44
#1
andyjordaan avatar

andyjordaan

New Zenner

Join Date:
Mar 2012
Posts:
29
Plugin Contributions:
0

Working With Pdf's

Hi All, it's not hard to know more than me, I read a lot, but cannot find my solution, Here is my Battlefield of the last few weeks
VPS Server 18.04
Zencart 1.5.7 and 1.5.7a
My Website www. macspares DOT co DOT za
PHP 7.2
readwrite is enabled

My Problem is I cannot get PDF's from the EZ-Pages to Display or even just to Download

I have been using Zencart since 1.3.7 but recently had to upgrade the VPS from Ubuntu 14 to current.
A Few Weeks ago we noticed that the html in the EZ-Pages was serving 404 errors for pdf Documents
here is a copy one one:

<p><a href="var/www/mywebsite.co.za/images/extras/diagrams/600-1000V-LV-Cable.pdf" target="_blank">AC Current Ratings : 600-1000V LV Cable</a></p>

here is the error on 1.5.7 :: ERROR 404 - Not Found!
here is the error on 1.5.7a :: ( the site is called "newco.co.za" a basic Zencart with demo products and is not published )
The requested URL was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Apache/2.4.29 (Ubuntu) Server at newco.co.za Port 80


In the prior weeks I have blamed the VPS and then the Zencart upgrades Maybe the Html ?
There is no indication in the VPS Logs or the Zencart Logs, I have even tried "Strict Error Reporting "

Another snippet of information is I have " Front Accounting" that regularly and continuously serves PDF's as invoices as well as Pdf's into emails from the same container
18 Nov 2020, 14:50
#2
barco57 avatar

barco57

Totally Zenned

Join Date:
Apr 2006
Posts:
2,841
Plugin Contributions:
0

Re: Working With Pdf's

first, you need to adjust the .htaccess in the images folder to allow the loading of pdf files from the images folder, it does not by default
Second the following (/var/www is wrong):
<a href="var/www/mywebsite.co.za/images/extras/diagrams/600-1000V-LV-Cable.pdf" target="_blank">
should be
<a href="http://www.macspares.co.za/images/extras/diagrams/600-1000V-LV-Cable.pdf" target="_blank">
if that is actually the file path to that pdf
18 Nov 2020, 17:39
#3
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Posts:
10,620
Plugin Contributions:
212

Re: Working With Pdf's

As a suggestion, you might want to create a new folder (called, say, "/pdfs") and put your PDFs in there, instead of putting them in the images folder.
Copy the .htaccess and index.html files from images and adjust .htaccess as noted above by @barco57.

Second suggestion - if you're using target="_blank", also use rel="noreferrer noopener"
23 Nov 2020, 08:10
#4
andyjordaan avatar

andyjordaan

New Zenner

Join Date:
Mar 2012
Posts:
29
Plugin Contributions:
0

Re: Working With Pdf's

Pew . . . I got the heavy hitters . . Thanks
Barco57
Thanks, I did not even know I had a .htaccess in the images folder( and I looked all over for it ) , with the code correction and sorting out the PDF in the .htaccess the problem is sorted .

swguy
YES I agree the website has gone thru many upgrades and the images folder is very bloated . . . .With this upgrade I am trying to reduce the historical errors and your advice will be followed.

Thank you
23 Nov 2020, 11:47
#5
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Posts:
10,620
Plugin Contributions:
212

Re: Working With Pdf's

Adding PDFs with instructions, documentation, addition info, etc. is a great way to make your site more informative. Good luck!