Open PDF File download in PHP

<?php

$file = $pdfName;
$path = “CreditReports/”.$pdfName;
$fr = fopen($path, ‘r’);
$filedata = fread($fr, filesize($path));
fclose($fr);

header ( ‘Content-Length: ‘ . filesize ( $path ) );
header(“Content-type: application/pdf“);
header(“Content-disposition: attachment; filename=$file”);
readfile($path);

?>

Before This we have to Check PDF Function Take a look on the below site

http://www.developertutorials.com/tutorials/php/easy-pdf-generation-in-php-8-02-27-922/

  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.