File: /home/imensosw/www/imenso.co/demo/resume-maker/download-cv.php
<?php
ob_start();
session_start();
require('include/initalizedb.php');
if($_SESSION['session_id'] == $_GET['u']){
$file_name = 'users-cv/'.$_GET['u'].'_'.$_GET['r'].'.html';
//echo file_exists($file_name);
$pdf_name = 'CV_'.$_GET['u'].'_'.$_GET['r'].'.pdf';
if(file_exists($file_name)){
require 'pdfcrowd.php';
try
{
// create an API client instance
$client = new Pdfcrowd("rahuljoshi", "5f90615b7443e6a33056d5735159e86c");
// convert a web page and store the generated PDF into a $pdf variable
$pdf = $client->convertURI('http://dev.imenso.co/enhan_cv/'.$file_name);
// set HTTP response headers
header("Content-Type: application/pdf");
header("Cache-Control: max-age=0");
header("Accept-Ranges: none");
header("Content-Disposition: attachment; filename=\"CV.pdf\"");
// send the generated PDF
echo $pdf;
}
catch(PdfcrowdException $why)
{
echo "Pdfcrowd Error: " . $why;
}
}else{ echo 'No Download Available for this CV.';}
}else { echo 'Please make Login or Try to download only your CVs.';}
?>