Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2011-06-10 01:17:18
- Vinster
- New Member
- From: Montreal, Québec, Canada
- Registered: 2011-06-09
- Posts: 7
Web-based pdf viewer
Hi everyone!
I’ve got a simple tasks, yet I can’t seem to find the proper documentation or example to help me out.
I’ve got a website that had many pdf files. At the moment, people have to download each of them to read them. I’d like to offer 2 ways of reading the pdfs. The first would be the current method, download the file and read in on the computer. The second one, which I’m trying to do, is when clicking on a pdf link, a container is displayed containing the embed pdf so it is possible to read it on the page without having to download it.
I know it’s possible, but I can’t seem to find how to do it.
Thanks for any help you can provide!
Last edited by Vinster (2011-06-10 02:03:40)
Hope for the best, but prepare for the worst!
Offline
#2 2011-06-10 02:02:57
- masa
- Member
- From: Asturias, Spain
- Registered: 2005-11-25
- Posts: 1,091
Re: Web-based pdf viewer
Vinster wrote:
At the moment, people have to download each of them to read them. I’d like to offer 2 ways of reading the pdfs. The first would be the current method, download the file and read in on the computer.
That is what Textpattern does by default when you use links similar to:
http://domain.com/file_download/01/file.pdf – note the file_download/
The second one, which I’m trying to do, is when clicking on a pdf link, a container is displayed containing the embed pdf so it is possible to read it on the page without having to download it.
It will be downloaded nevertheless. However you can make a PDF render in a browser window via Acrobat Rreader by linking directly to the file, circumventing TXP’s linking syntax and linking to the file in the ‘files’ directory:
http://domain.com/files/file.pdf
Offline
Re: Web-based pdf viewer
Another possibility I have used is Scribd – you just upload the document there and then you can embed the viewer anywhere you like. I thought they had the smoothest implementation, but there is also Google, Flexpaper and other methods.
Offline
Re: Web-based pdf viewer
However you can make a PDF render in a browser window via Acrobat Rreader by linking directly to the file, circumventing TXP’s linking syntax and linking to the file in the ‘files’ directory:
http://domain.com/files/file.pdf
Note, though, that you lose the ability to count the downloads or display the file download count using the txp tag. If you still need to ascertain how often a file is requested, you can do that with your stats/webtracker, for example with Google Analytics you can track certain additional events such as a file download, external links etc., although you do need to set it up specifically.
TXP Builders – finely-crafted code, design and txp
Offline
#5 2011-06-10 09:46:36
- Vinster
- New Member
- From: Montreal, Québec, Canada
- Registered: 2011-06-09
- Posts: 7
Re: Web-based pdf viewer
@michaelkpate : One’s thing for sure I’d rather not upload the files on another website. I want to keep them hosted on my side, just display them to the user.
@masa and jakob : I think I’ll use this method. It doesn’t have the special “pdf viewer” I’d like, but it will do. As long as the user don’t have to download the file to read it, I’m ok. (Actually, they’ll have both choise, since the link will open de document and the picture show the file type will be the download link)
So at the moment I use the “<txp:file_download_link>” tag which give me the download link “website.com/file_download/Document #”. Is there a tag that only shows the direct link to the file ? Since I’m in a download form, I don’t know the name of the file. Actually I do with “<txp:file_download_name />”, but the file name has spaces, so the link doesn’t work.
I’m still working on thise so I might figure it out. [EDIT] Fount it, I forgot the /files/ in my link. Still it would be great to have a textpattern tag that does this, so I wouldn’t have to use the html code for the link and write /files/ manually. The textpattern tag would also work with the download count.
@jakob : Thanks for the Google Analytics info, I didn’t know you could do that.
Last edited by Vinster (2011-06-10 10:00:19)
Hope for the best, but prepare for the worst!
Offline
Pages: 1