SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Aug 2009
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    how to download pdf ?? with php

    Can anyone tel me how to develop pdf downloader in PHP ??? I want to make module in site so user can download pdf . Plz reply as soon as possible.

  2. #2
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,784
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    The following will offer the pdf passed into it in $pdf for download.

    PHP Code:
    header('Cache-Control:');
    header('Pragma:');
    header('Content-type: application/pdf');
    header('Content-Disposition: attachment; filename="$pdf"');
    header('Content-Length: ' filesize($pdf));
    readfile("$pdf"); 
    The content-disposition of attachment tells it to offer the file for download.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •