diff options
author | Sashi20 | 2018-07-02 16:44:33 +0530 |
---|---|---|
committer | Sashi20 | 2018-07-02 16:44:33 +0530 |
commit | 0456cc90ef77a963dec34de3cf45599f27c9cabe (patch) | |
tree | 791db4fedf4fc60194e72758050a7ee42688848d /pdf | |
parent | d96ff8c220053b7065c7047c46797caf35071195 (diff) | |
download | r_textbook_companion-0456cc90ef77a963dec34de3cf45599f27c9cabe.tar.gz r_textbook_companion-0456cc90ef77a963dec34de3cf45599f27c9cabe.tar.bz2 r_textbook_companion-0456cc90ef77a963dec34de3cf45599f27c9cabe.zip |
Added headers to download certificate
Diffstat (limited to 'pdf')
-rwxr-xr-x | pdf/generate_pdf.inc | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/pdf/generate_pdf.inc b/pdf/generate_pdf.inc index 2f1f422..874900b 100755 --- a/pdf/generate_pdf.inc +++ b/pdf/generate_pdf.inc @@ -144,9 +144,28 @@ function generate_pdf() $pdf->SetX(222); $pdf->Image($sign, $pdf->GetX()-130, $pdf->GetY()+5, 60, 0); $pdf->Image($pngAbsoluteFilePath, $pdf->GetX(), $pdf->GetY()+2, 30, 0); - $name = $data3->full_name; - $certificate_name = str_replace(' ', '_', $name); - $pdf->Output($certificate_name . '_R_TBC_Certificate.pdf', 'D'); + //$name = $data3->full_name; + //$certificate_name = str_replace(' ', '_', $name); + //$pdf->Output($certificate_name . '_R_TBC_Certificate.pdf', 'D'); + $pdf->SetFont('Arial', 'I', 8); + $pdf->SetTextColor(0, 0, 0); + $filename = str_replace(' ', '-', $data3->contributor_name) . '-R_TBC_Certificate.pdf'; + $file = $path . '/pdf/temp_certificate/' . $proposal_id . '_' . $filename; + $pdf->Output($file, 'F'); + header("Content-Type: application/octet-stream"); + header("Content-Disposition: attachment; filename=" . $filename); + header("Content-Type: application/octet-stream"); + header("Content-Type: application/download"); + header("Content-Description: File Transfer"); + header("Content-Length: " . filesize($file)); + flush(); + $fp = fopen($file, "r"); + while (!feof($fp)) { + echo fread($fp, 65536); + flush(); + } //!feof($fp) + fclose($fp); + unlink($file); /*} else { |