0

Currently working on an offshoot of the idea more adequately addressed here. Creating a Secure File Hosting Server for PDFs

I'm developing a secure PDF hosting website where certain users can download certain PDF's that I have stored outside of the webroot to prevent people from accessing documents they shouldn't access.

I've got the download working using the first solution, but I want to implement a 'view/preview' feature too. I still don't get content headers as well as I should but I believe what is causing the bulk of my issues is I can't put a 'src' attribute on the embed/object/iframe/whatever. And that's kind of the point of the system.

My question is, is there any way to feed a file (as opposed to a url) to an embed/object? I would like to keep my current system and I'm going for simplicity at the moment so the easier the better.

I saw Recommended way to embed PDF in HTML? and will probably check out pdf.js if I'm trying something that isn't doable.

Community
  • 1
  • 1
Will
  • 733
  • 8
  • 23

2 Answers2

0

I have not yet had the chance to play with pdf.js, but it either that or a flash player of some sort.

Or you rely on the browser to display it has a webpage and you can iframe it, but that's so lame... it would work only for a fraction of you users.

3on
  • 6,291
  • 3
  • 26
  • 22
0

PDF2SWF - convert PDF to SWF ( 1 page = 1 SWF).

Use other SWF (reader) to load SWF pages via XML or something else.

Use $_SESSION to store ID of PDF document which should be served through e.g. /preview (same link for previewing all documents)

Don't serve original PDF, put a watermark, or make them low-res. Otherwise, your PDF will never be "secure".

http://www.swftools.org/

Dejan Marjanović
  • 19,244
  • 7
  • 52
  • 66