Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64
Your IP : 18.220.43.27
Current Path : /var/www/html/ibm/ |
| Current File : /var/www/html/ibm/pdftoimage.php |
<?php
ini_set("display_errors","On");
error_reporting(E_ALL ^ E_NOTICE);
require_once(__DIR__."/../aws/aws-autoloader.php");
require_once(__DIR__."/../bcu/tcpdf/tcpdf.php");
use Aws\S3\S3Client;
use Aws\S3\Exception\S3Exception;
$s3 = S3Client::factory(
array(
'credentials' => array(
'key' => IAM_KEY,
'secret' => IAM_SECRET
),
'version' => "latest",
'region' => 'ap-south-1'
)
);
$keyname = "003D/MC_003_901D1161_A_2016_1.pdf";
$filePath = "file.pdf";
$result = $s3->getObject([
'Bucket' => "kuvempu-university-marks-card-verification",
'Key' => $keyname,
'SaveAs' => $filePath
]);
$im = new imagick();
$im->setResolution(150,150);
$im->readImage('https://kuvempu-university-marks-card-verification.s3.ap-south-1.amazonaws.com/003D/MC_003_901D1161_A_2016_1.pdf');
$im->setImageFormat('jpeg');
// header('Content-Type: image/jpeg');
// echo $im;
// var_dump($im);
$filePath = tempnam(sys_get_temp_dir(), rand(10,15));
$im->setImageCompression(imagick::COMPRESSION_JPEG);
$im->setImageCompressionQuality(80);
$im->writeImage ($filePath);
$im->clear();
$im->destroy();
$pdf = new TCPDF('P');
$pdf->SetMargins(0, 0);
// $pdf->startPageGroup();
$pdf->AddPage("P");
$pdf->SetFont('Times', '', 10);
// $pdf->Image($filePath, 0, 0, 250, 500);
// get the current page break margin
$bMargin = $pdf->getBreakMargin();
// get current auto-page-break mode
$auto_page_break = $pdf->getAutoPageBreak();
// disable auto-page-break
$pdf->SetAutoPageBreak(false, 0);
// set bacground image
$pdf->Image($filePath, 0, 0, 210, 297, '', '', '', false, 300, '', false, false, 0);
// restore auto-page-break status
$pdf->SetAutoPageBreak($auto_page_break, $bMargin);
// set the starting point for the page content
$pdf->setPageMark();
// $pdf->SetAutoPageBreak(false, 0);
$pdf->setY(250);
$pdf->setX(50);
date_default_timezone_set('Asia/Kolkata');
$html = '<div style="border: 0.5px solid green;border-radius: 3px;padding: 5px;color:green;text-align:center;font-weight:bold;font-size:10px;">
<img src="http://oasis.logisys.org/kus/img/logoh.jpg" width="132" />
<span> This Certificate <br/> electronically verified and found GENUINE </span>
<br/>
<img src="http://oasis.logisys.org/kus/img/controler_sign.jpg" width="40" />
<br/>
<span>Date '.date("d/m/Y").' Reg.(Eval)</span>
</div>';
$pdf->writeHTMLCell($w=50, $h=40, $x = 155, $y= 220, $html, $border=0, $ln=0, $fill=0, $reseth=true, $align='', $autopadding=false);
// $pdf->writeHTML($html, true, false, true, false, '');
$pdf->Output("Certificate.pdf", "I");
?>
|