No announcement yet.

Link pdf

  • Filter
  • Time
  • Show
Clear All
new posts

  • Link pdf

    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.

  • #2
    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
    Albert Drent
    aducom software netherlands
    scriptcase partner, reseller, support and (turn-key) development /


    • #3
      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.


      • #4
        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 There are other solutions as well but these are easy.