Hello generated a link to a pdf document, how I can do that is displayed?
Currently when I select download and it does not want.
thanks
I’m not sure what you did. Just link straight to the pdf file? Are you sure you’re path is ok? In general if you need to download a pdf you need to output the correct html sequence to do so. Below is a generic code which can be exported using a blank application which will download the file. If you make the filename and path a global var then it will become a pretty generic solutions for this.
header("Content-Type: application/octet-stream");
$file = $_GET["file"] .".pdf";
header("Content-Disposition: attachment; filename=" . urlencode($file));
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
header("Content-Description: File Transfer");
header("Content-Length: " . filesize($file));
flush(); // this doesn't really matter.
$fp = fopen($file, "r");
while (!feof($fp))
{
echo fread($fp, 65536);
flush(); // this is essential for large downloads
}
fclose($fp);
Maybe I have not explained well: I have a form where a field upload upload the document (pdf), then the grid, would like to see that document not download the document.
That is only supported if your browser has a pdf reader installed or embedded. e.g. adobe reader, maxthon 4, etc…
If you insist in having it displayed in html you need somethin like pdf2htmlEX or https://github.com/mozilla/pdf.js. There are other solutions as well but these are easy.