summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSashi202020-10-07 12:54:38 +0530
committerSashi202020-10-07 12:54:38 +0530
commit94f06e717ab414c3df505147f44642452bc27daf (patch)
tree577183c8d9003cf6245a4f335df00d4de97fc335
parent56f7a3990023caa0052dbb1b9185b03c56c35517 (diff)
downloadom_pssp-94f06e717ab414c3df505147f44642452bc27daf.tar.gz
om_pssp-94f06e717ab414c3df505147f44642452bc27daf.tar.bz2
om_pssp-94f06e717ab414c3df505147f44642452bc27daf.zip
Update functions w.r.t fpdf version and update headers to download file
-rwxr-xr-xpdf/cert_new.inc26
-rwxr-xr-xpdf/mentor_cert_pdf.inc28
2 files changed, 35 insertions, 19 deletions
diff --git a/pdf/cert_new.inc b/pdf/cert_new.inc
index 43346de..ed37dee 100755
--- a/pdf/cert_new.inc
+++ b/pdf/cert_new.inc
@@ -42,7 +42,7 @@ function generate_pdf()
} //!$pdf
$pdf->AddPage();
$image_bg = $mpath . "/pdf/images/bg_cert.png";
- $pdf->Image($image_bg, 0, 0, $pdf->w, $pdf->h);
+ $pdf->Image($image_bg, 0, 0, $pdf->GetPageWidth(), $pdf->GetPageHeight());
$pdf->SetMargins(18, 1, 18);
$path = drupal_get_path('module', 'om_pssp');
$pdf->Ln(50);
@@ -53,18 +53,18 @@ function generate_pdf()
$pdf->SetFont('Times', 'I', 16);
$pdf->SetTextColor(37, 22, 247);
$contributor_name = WordWrap($data3->contributor_name,70);
- $pdf->MultiCell(240, 8, $data3->name_title . '. ' . $contributor_name, '0', 'C');
+ $pdf->MultiCell(240, 8, $data3->name_title . '. ' . utf8_decode($contributor_name), '0', 'C');
$pdf->Ln(0);
$pdf->SetFont('Times', '', 14);
$title = WordWrap($data3->project_title,160);
$university = WordWrap('from ' . $data3->university . ' has successfully contributed under the ', 160);
$pdf->SetTextColor(0, 0, 0);
- $pdf->MultiCell(240, 8, $university . 'OpenModelica Power Systems Simulation Project.', '0','C');
+ $pdf->MultiCell(240, 8, utf8_decode($university) . 'OpenModelica Power Systems Simulation Project.', '0','C');
$pdf->Ln(0);
$pdf->Cell(240, 8, 'He/She has created the following simulation', '0', '1', 'C');
$pdf->SetTextColor(37, 22, 247);
$pdf->SetFont('Times','I',16);
- $pdf->MultiCell(240, 8, $title, '0', 'C');
+ $pdf->MultiCell(240, 8, utf8_decode($title), '0', 'C');
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('Times','',14);
$pdf->Cell(240, 8, 'using OpenModelica. The code is available at ', '0', '', 'C');
@@ -125,18 +125,26 @@ function generate_pdf()
$filename = str_replace(' ', '-', $data3->contributor_name) . '-OpenModelica-PSSP-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");
+ ob_clean();
+ header("Pragma: public");
+ header("Expires: 0");
+ header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
+ header("Cache-Control: public");
header("Content-Description: File Transfer");
+ header("Content-Type: application/pdf");
+ header("Content-Disposition: attachment; filename=" . $filename);
header("Content-Length: " . filesize($file));
+ header("Content-Transfer-Encoding: binary");
+ header("Expires: 0");
+ header("Pragma: no-cache");
flush();
$fp = fopen($file, "r");
while (!feof($fp)) {
- echo fread($fp, 65536);
+ echo fread($fp, filesize($file));
flush();
} //!feof($fp)
+ ob_end_flush();
+ ob_clean();
fclose($fp);
unlink($file);
//drupal_goto('flowsheeting-project/certificate');
diff --git a/pdf/mentor_cert_pdf.inc b/pdf/mentor_cert_pdf.inc
index e40de30..900fccb 100755
--- a/pdf/mentor_cert_pdf.inc
+++ b/pdf/mentor_cert_pdf.inc
@@ -35,7 +35,7 @@ function generate_pdf()
} //!$pdf
$pdf->AddPage();
$image_bg = $mpath . "/pdf/images/bg_cert_mentor.png";
- $pdf->Image($image_bg, 0, 0, $pdf->w, $pdf->h);
+ $pdf->Image($image_bg, 0, 0, $pdf->GetPageWidth(), $pdf->GetPageHeight());
$pdf->SetMargins(18, 1, 18);
$path = drupal_get_path('module', 'om_pssp');
$pdf->Ln(43);
@@ -45,7 +45,7 @@ function generate_pdf()
$pdf->Ln(-6);
$pdf->SetFont('Times', 'BI', 16);
$pdf->SetTextColor(13, 5, 130);
- $pdf->Cell(240, 8, $data3->project_guide_name, '0', '1', 'C');
+ $pdf->Cell(240, 8, utf8_decode($data3->project_guide_name), '0', '1', 'C');
$pdf->Ln(0);
$pdf->SetFont('Times', 'I', 12);
if (strtolower($data3->branch) != "others") {
@@ -54,20 +54,20 @@ function generate_pdf()
$pdf->Cell(240, 8, 'from', '0', '1', 'C');
$pdf->Ln(0);
$pdf->SetFont('Times','BI',16);
- $pdf->Cell(240, 8, $data3->project_guide_university, '0','1','C');
+ $pdf->Cell(240, 8, utf8_decode($data3->project_guide_university), '0','1','C');
$pdf->Ln(0);
$pdf->SetFont('Times', 'I', 12);
$pdf->Cell(240, 8, 'who has mentored', '0', '1', 'C');
$pdf->Ln(0);
$pdf->SetFont('Times', 'BI', 16);
- $pdf->Cell(240, 8, $data3->contributor_name, '0', '1', 'C');
+ $pdf->Cell(240, 8, utf8_decode($data3->contributor_name), '0', '1', 'C');
$pdf->Ln(0);
$pdf->SetFont('Times', 'I', 12);
$pdf->Cell(240, 8, 'for successfully completing internship under the Power System Simulation Project. The intern(s) has created a Simulation titled', '0', '1', 'C');
$pdf->Ln(0);
$pdf->SetFont('Times', 'BI', 16);
$pdf->SetTextColor(13, 5, 130);
- $pdf->Cell(240, 8, $data3->project_title, '0', '1', 'C');
+ $pdf->Cell(240, 8, utf8_decode($data3->project_title), '0', '1', 'C');
$pdf->SetTextColor(13, 5, 130);
$pdf->Ln(0);
$pdf->SetFont('Times', 'I', 12);
@@ -114,18 +114,26 @@ function generate_pdf()
$filename = str_replace(' ', '-', $data3->project_guide_name) . '-OpenModelica-PSSP-Mentor-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");
+ ob_clean();
+ header("Pragma: public");
+ header("Expires: 0");
+ header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
+ header("Cache-Control: public");
header("Content-Description: File Transfer");
+ header("Content-Type: application/pdf");
+ header("Content-Disposition: attachment; filename=" . $filename);
header("Content-Length: " . filesize($file));
+ header("Content-Transfer-Encoding: binary");
+ header("Expires: 0");
+ header("Pragma: no-cache");
flush();
$fp = fopen($file, "r");
while (!feof($fp)) {
- echo fread($fp, 65536);
+ echo fread($fp, filesize($file));
flush();
} //!feof($fp)
+ ob_end_flush();
+ ob_clean();
fclose($fp);
unlink($file);
//drupal_goto('flowsheeting-project/certificate');