March 24th, 2013, 07:44 PM
Passing a pdf file through php
I am used this code:
header("Pragma: public"); // required
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Disposition: attachment; filename=\"".basename($filename)."\";" );
and it does open the file and pass it through the browser, after it downloads, when I open the PDF file, it tells me that it could not open the file because "it is either not a supported file type or because the file has been damaged..."
can you tell me how to fix this?
March 25th, 2013, 05:47 AM
there is a library fpdf or something similar (please search). I used it couple of years back and it created PDFs for me.
March 25th, 2013, 05:00 PM
I don't need to create a pdf, just pass it through... open it and print it to their browser, so that they can download it securely.
That way if they share it, they have to share the file, not the link to download(saving my bandwidth)...
A few of the files are encrypted as well, allowing the file to open and print in high resolution, but not changable... so it has to be able to still download those. I use a wordpress plugin that secures the link, but with the encrypted files, they are unreadable, so show as damaged when downloaded. So I wrote the php script to download them instead of the securelink plugin.
Any ideas how to make this work, without having to create a pdf, just pass an existing one through?
Originally Posted by paulh1983
March 26th, 2013, 05:19 AM
so are you saying the file is already a pdf?