Html to Pdf Script Yaptırılacak
11
●268
- 15-02-2021, 16:43:30
<?php class HTML2PDF{ function HTML2PDF($APIKEY) { $this->APIKEY = $APIKEY; } function pageSize($pageSize){ $this->pageSize = $pageSize; } function prepare($prepare){ $this->prepare = $prepare; } function pdfTitle($pdfTitle){ $this->pdfTitle = $pdfTitle; } function pdfHTML($pdfHTML){ $this->pdfHTML = $pdfHTML; } function create() { $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_HTTPHEADER => array('Authentication: '.$this->APIKEY.''), CURLOPT_RETURNTRANSFER => 1, CURLOPT_URL => 'https://api.bitnameagency.com/API.php', CURLOPT_POST => 1, CURLOPT_POSTFIELDS => array('pageSize' => $this->pageSize, 'html' => $this->pdfHTML))); if($this->prepare == "download"){ header("Content-type:application/pdf"); header("Content-Disposition:attachment;filename=".$this->pdfTitle.".pdf"); echo curl_exec($curl); }elseif($this->prepare == "touch"){ file_put_contents($this->pdfTitle.".pdf", curl_exec($curl)); echo '<a id="HTML2PDFLink" href="/'.$this->pdfTitle.'.pdf">'.$this->pdfTitle.'.pdf</a>'; }else{ header("Content-type:application/pdf"); echo curl_exec($curl); } curl_close($curl);}} ?><?php include_once("HTML2PDF_CLASS.php"); $HTML2PDF = new HTML2PDF('FREE'); // API KEY $HTML2PDF->pageSize("500x600"); //min 50x50 $HTML2PDF->prepare("Download"); // view - download - touch $HTML2PDF->pdfTitle("Dosya İsmi"); $HTML2PDF->pdfHTML("HTML DATA"); $HTML2PDF->create(); ?>Sistem benim kullanabilirsiniz. - 15-02-2021, 21:12:50Teşekkür ederimsancakmedia adlı üyeden alıntı: mesajı görüntüle