コード例 #1
1
 public function generer($html, $nom_fichier = '', $dest = 'I', $sens = self::SENS, $format = self::FORMAT, $margin = array(self::MARGIN, self::MARGIN, self::MARGIN, self::MARGIN))
 {
     try {
         $html2pdf = new HTML2PDF($sens, $format, self::LANG, self::UNICODE, self::ENCODING, $margin);
         $html2pdf->pdf->SetDisplayMode('real');
         $html2pdf->writeHTML($html);
         $html2pdf->Output($nom_fichier, $dest);
     } catch (Exception $e) {
         die("Echec de création du document PDF: {$e}");
     }
 }
コード例 #2
0
 public function voucher($numFile = false)
 {
     if (!$numFile) {
         $this->redireccionar('booking');
     }
     //Session::acceso('Usuario');
     $numFile = base64_decode($numFile);
     $numFile = $numFile * 1;
     $ruta_img = 'views/layout/' . DEFAULT_LAYOUT . '/img/';
     $ruta_img2 = 'public/img/voucher/';
     ob_start();
     require_once ROOT . 'views' . DS . 'system' . DS . 'pdf' . DS . 'vouchea.php';
     $content = ob_get_clean();
     $this->getLibrary('html2pdf.class');
     try {
         $html2pdf = new HTML2PDF('P', 'A4', 'es', false, CHARSET);
         //$html2pdf->setModeDebug();
         $html2pdf->setDefaultFont('Arial');
         $html2pdf->writeHTML($content, isset($_GET['vuehtml']));
         $html2pdf->Output('Voucher_N_' . $numFile . '.pdf');
     } catch (HTML2PDF_exception $e) {
         echo $e;
         exit;
     }
 }
コード例 #3
0
ファイル: ijazah.php プロジェクト: bosokpp1/p-siakad
 function laporan_pdf($kode)
 {
     $data['kd_mahasiswa'] = $kode;
     $this->load->library('HTML2PDF');
     $html2pdf = new HTML2PDF('L', 'Letter', 'fr');
     $html2pdf->setDefaultFont('Arial');
     //filter
     #get filter
     /* $fil['kd_fakultas'] = $kd_fakultas;
     		$fil['kd_prodi'] = $kd_prodi;
     		$fil['tahun'] = $tahun;
     		$fil['nim'] = $nim; */
     //$data['nama'] = 'indriyanto';
     $data['namaUniv'] = 'UNIVERSITAS SUBANG';
     $data['alamatUniv'] = 'Jln. Perkutut Kotaraja, Telp.(0967)581562';
     $data['kotaUniv'] = 'Subang, Jawa Barat';
     // ambil data dari tabel
     $data['data_pdf'] = $this->mdl_ijazah->get_pdf($kode);
     /* if (count($da['row'])==0){
     			echo "Data Tidak Tersedia";
     			return;
     		} */
     $konten = $this->load->view('ta/ijazah_format', $data, true);
     $html2pdf->writeHTML($konten, false);
     $html2pdf->Output('exemple00.pdf');
 }
コード例 #4
0
function rappel($buffer)
{
    $date = date('Ymd-hi');
    $html2pdf = new HTML2PDF('P', 'LETTER', 'fr');
    $html2pdf->writeHTML($buffer);
    $html2pdf->Output($date . '_valeur_inventaire.pdf', 'D');
}
コード例 #5
0
ファイル: khs.php プロジェクト: bosokpp1/p-siakad
 function laporan_pdf($kd_fakultas, $kd_prodi, $tahun, $nim)
 {
     $this->load->library('HTML2PDF');
     $html2pdf = new HTML2PDF('P', 'A4', 'fr');
     $html2pdf->setDefaultFont('Arial');
     //filter
     #get filter
     $fil['kd_fakultas'] = $kd_fakultas;
     $fil['kd_prodi'] = $kd_prodi;
     $fil['tahun'] = $tahun;
     $fil['nim'] = $nim;
     //$data['nama'] = '';
     $data['namaUniv'] = 'STMIK BANDUNG';
     $data['alamatUniv'] = 'Jl.Phh.Mustofa No. 39. Grand Surapati Core (SUCORE) Blok M No.19, Telp.022 - 7207777';
     $data['kotaUniv'] = 'Bandung, Jawa Barat';
     // ambil data dari tabel
     $data['data_pdf'] = $this->mdl_khs->get_pdf($fil, $nama_dosen);
     /* if (count($da['row'])==0){
     			echo "Data Tidak Tersedia";
     			return;
     		} */
     $konten = $this->load->view('perkuliahan/khs_laporan', $data, true);
     $html2pdf->writeHTML($konten, false);
     $html2pdf->Output('khs.pdf');
 }
コード例 #6
0
ファイル: Htmlpdf.php プロジェクト: Kamatis/Xiphias
 public function convert($data)
 {
     $width = 8.5 * 25.4;
     $height = 11 * 25.4;
     $html = new HTML2PDF('P', array($width, $height), 'en');
     $html->writeHTML($data);
     //		header('Cache-Control: private, max-age=0, must-revalidate');
     $html->Output('resume.pdf');
 }
コード例 #7
0
ファイル: laporan_delivery.php プロジェクト: bosokpp1/purlog
 function laporan_pdf($date_1, $date_2)
 {
     $this->load->library('HTML2PDF');
     $html2pdf = new HTML2PDF('P', 'A4', 'fr');
     $html2pdf->setDefaultFont('Arial');
     $data['data_pdf'] = $this->mdl_report_delivery->report_delivery_pdf($date_1, $date_2);
     $konten = $this->load->view('report_delivery/delivery_report', $data, true);
     $html2pdf->writeHTML($konten, false);
     $html2pdf->Output("Report_delivery_" . $date_1 . " To " . $date_2 . ".pdf");
 }
コード例 #8
0
ファイル: Reporte.php プロジェクト: richarrieta/miequipo
 private function generarPDF($vista, $data, $orientacion)
 {
     require_once app_path('/ayudantes/report/html2pdf.class.php');
     $pdf = new \HTML2PDF($orientacion, 'letter', 'es');
     $pdf->pdf->SetDisplayMode('fullpage');
     try {
         $html = \View::make($vista, $data)->render();
         $pdf->writeHTML($html);
         $pdf->Output($vista . '.pdf');
     } catch (\HTML2PDF_exception $e) {
         die($e . " :(");
     }
     die;
 }
コード例 #9
0
ファイル: welcome.php プロジェクト: Asepdadan/export-ci
 public function index()
 {
     $this->load->model('model_data');
     $data['data'] = $this->model_data->tampil();
     ob_start();
     $content = $this->load->view('data', $data);
     $content = ob_get_clean();
     $this->load->library('html2pdf');
     try {
         $html2pdf = new HTML2PDF('L', 'A4', 'fr');
         $html2pdf->pdf->SetDisplayMode('fullpage');
         $html2pdf->writeHTML($content, isset($_GET['vuehtml']));
         $html2pdf->Output('print.pdf');
     } catch (HTML2PDF_exception $e) {
         echo $e;
         exit;
     }
 }
コード例 #10
0
ファイル: Convertor.php プロジェクト: mdox/engine
 /**
  * @return  self
  */
 public function convert($filePathIn, $filePathOut, $formats = ['html', 'pdf'])
 {
     $output = ['html' => '', 'pdf' => ''];
     $replace = ['content' => '', 'js' => '', 'css' => ''];
     try {
         $tpl = TemplatesRegistry::get($this->usedTemplate);
         foreach (['js', 'css'] as $type) {
             foreach ($tpl[$type] as $file) {
                 if (!is_readable($file)) {
                     throw new \Exception("Cannot load file {$file}.");
                 }
                 $file = file_get_contents($file);
                 $replace[$type] .= $file . "\n";
             }
         }
         if (file_exists("{$filePathOut}.html")) {
             unlink("{$filePathOut}.html");
         }
         $replace['content'] = $this->mdParser->parse(file_get_contents($filePathIn));
         $output['html'] = $this->latte->renderToString($tpl['layout'], $replace);
         $this->fs->write("{$filePathOut}.html", $output['html']);
         if (in_array('pdf', $formats)) {
             try {
                 $html2pdf = new \HTML2PDF('P', 'A4', 'cs');
                 $html2pdf->setDefaultFont('dejavusans');
                 //$html2pdf->addFont('dejavusans');
                 $html2pdf->pdf->SetDisplayMode('real');
                 $output['html'] = str_replace('\\xe28087', "  ", $output['html']);
                 $html2pdf->writeHTML($output['html']);
                 $pdf = $html2pdf->Output("{$filePathOut}.pdf", 'S');
                 $this->fs->write("{$filePathOut}.pdf", $pdf);
             } catch (Html2PdfException $e) {
                 $formatter = new ExceptionFormatter($e);
                 echo "PDF: " . $formatter->getHtmlMessage();
             }
         }
         if (!in_array('html', $formats)) {
             //unlink("{$filePathOut}.html");
         }
     } catch (\InvalidArgumentException $e) {
         echo $e->getMessage(), "\n";
     }
     return $this;
 }
コード例 #11
0
ファイル: PdfController.php プロジェクト: TBoonX/SlideWiki
 function test()
 {
     $item_id = $_GET['id'];
     if (isset($_GET['show_answers'])) {
         $show_answers = $_GET['show_answers'];
     } else {
         $show_answers = 2;
     }
     $test = new Test();
     $test->createFromItem($item_id);
     $test->questions = $test->getAllQuestions();
     $content = '';
     $content .= '<h2>List of questions for ' . $test->title . ' course</h2>';
     $questions = $test->questions;
     if (count($questions)) {
         $content .= '<ol>';
         for ($i = 0; $i < count($questions); $i++) {
             $content .= '<li>' . $questions[$i]->question . '<br/>';
             if ($show_answers) {
                 foreach ($questions[$i]->answers as $answer) {
                     if ($show_answers == '2') {
                         if ($answer['is_right'] == 'yes') {
                             $content .= '&#9745;&nbsp;&nbsp;&nbsp;';
                         } else {
                             $content .= '&#9744;&nbsp;&nbsp;&nbsp;';
                         }
                     } else {
                         $content .= '&#9744;&nbsp;&nbsp;&nbsp;';
                     }
                     $content .= $answer['answer'] . '<br/>';
                 }
             }
             $content .= '</li>';
         }
         $content .= '</ol>';
     }
     $content = '<page style="font-family: freeserif"><br />' . $content . '</page>';
     $html2pdf = new HTML2PDF('P', 'A4', 'fr');
     //$html2pdf->pdf->SetDisplayMode('real');
     $html2pdf->writeHTML($content);
     $html2pdf->Output('utf8.pdf');
 }
コード例 #12
0
 /**
  * Html to pdf and stream HTML2PDF
  *
  * @param $html
  * @param $name
  */
 public function streamPdfFile($html, $name)
 {
     // include html2pdf library
     require_once Mage::getBaseDir('lib') . '/html2pdf/html2pdf.class.php';
     // debug pdf html
     if (true == Mage::getStoreConfig('catalogexport/pdf/html_debug')) {
         echo $this->_prepare($html);
         die;
     }
     try {
         $html2pdf = new HTML2PDF('P', 'A4', 'en', true, 'UTF-8', 0);
         // display the full page
         //$html2pdf->pdf->SetDisplayMode('fullpage');
         //$html2pdf->createIndex('Sommaire', 25, 12, false, false);
         $html2pdf->writeHTML($this->_prepare($html));
         $html2pdf->Output($name . '.pdf');
         exit;
     } catch (HTML2PDF_exception $e) {
         echo $e;
         exit;
     }
 }
コード例 #13
0
ファイル: lap_peserta.php プロジェクト: bosokpp1/p-siakad
 function laporan_pdf($PMBPeriodID)
 {
     $this->load->library('HTML2PDF');
     $html2pdf = new HTML2PDF('L', 'A4', 'fr');
     $html2pdf->setDefaultFont('Arial');
     //filter
     #get filter
     $fil['PMBPeriodID'] = $PMBPeriodID;
     //$data['nama'] = '';
     $data['namaUniv'] = 'STMIK BANDUNG';
     $data['alamatUniv'] = 'Jl.Phh.Mustofa No. 39. Grand Surapati Core (SUCORE) Blok M No.19, Telp.022 - 7207777';
     $data['kotaUniv'] = 'Bandung, Jawa Barat';
     // ambil data dari tabel
     $data['data_pdf'] = $this->mdl_lap_peserta->get_pdf($fil);
     /* if (count($da['row'])==0){
     			echo "Data Tidak Tersedia";
     			return;
     		} */
     $konten = $this->load->view('pmb/peserta_laporan', $data, true);
     $html2pdf->writeHTML($konten, false);
     $html2pdf->Output('peserta_pmb.pdf');
 }
コード例 #14
0
ファイル: crud.php プロジェクト: mutaqin07/php
 public function cetak()
 {
     $date = new DateTime('now', new DateTimeZone('Asia/Jakarta'));
     $today = $date->format('d-m-Y');
     $this->load->model('crud_model');
     $data['data'] = $this->crud_model->reportUsers();
     ob_start();
     $content = $this->load->view('reportUser', $data);
     $content = ob_get_clean();
     $filename = "Lap_user" . $today . ".pdf";
     //nama file pdf
     $this->load->library('html2pdf');
     try {
         $html2pdf = new HTML2PDF('P', 'A4', 'en', false, 'ISO-8859-15', array(20, 10, 10, 10));
         //$html2pdf->pdf->SetDisplayMode('fullpage');
         $html2pdf->setDefaultFont('Arial');
         $html2pdf->writeHTML($content, isset($_GET['vuehtml']));
         $html2pdf->Output($filename);
     } catch (HTML2PDF_exception $e) {
         echo $e;
         exit;
     }
 }
コード例 #15
0
ファイル: salereports.php プロジェクト: marsa1985/kazabiz
    public function createPdf()
    {
        $salesPersonId = JFactory::getSession()->get('salesPersonId');
        //$filter = JRequest::getVar('filter', array('name' => "", 'code' => "", 'merchant_id' => "", 'fromdate' => "", 'todate' => ""));
        //$filter = JRequest::getVar('filter',array(),'post','array');
        $currency_prefix = JModel::getInstance('setting', 'enmasseModel')->getCurrencyPrefix();
        $dealList = JModel::getInstance('deal', 'enmasseModel')->searchBySaleReports($salesPersonId, JRequest::getVar('name'), JRequest::getVar('merchant_id'), JRequest::getVar('fromdate'), JRequest::getVar('todate'), JRequest::getVar('code'));
        if (empty($dealList)) {
            return null;
        }
        $result = '<table style="border:1px dotted #D5D5D5; border-collapse: collapse;"><tr valign="middle"><th style="border:1px dotted #D5D5D5;" align="center" width="50">' . JText::_("No") . '</th><th style="border:1px dotted #D5D5D5;" width="150">' . JText::_("Deal Code") . '</th><th style="border:1px dotted #D5D5D5;" width="150">' . JText::_("Deal Name") . '</th><th style="border:1px dotted #D5D5D5;" width="100">' . JText::_("Merchant") . '</th><th style="border:1px dotted #D5D5D5;" align="center" width="80">' . JText::_("Qty Sold") . '</th><th style="border:1px dotted #D5D5D5;" align="center" width="80">' . JText::_("Unit Price") . '</th><th style="border:1px dotted #D5D5D5;" align="center" width="80">' . JText::_("Total Sales") . '</th></tr>';
        $i = 0;
        foreach ($dealList as $row) {
            $i++;
            $merchant_name = JModel::getInstance('merchant', 'enmasseModel')->retrieveName($row->merchant_id);
            $total_sales = $row->price * $row->cur_sold_qty;
            $result .= '<tr>
				<td style="border:1px dotted #D5D5D5;" align="center">' . $i . '</td>
				<td style="border:1px dotted #D5D5D5;">' . $row->deal_code . '</td>
				<td style="border:1px dotted #D5D5D5;">' . $row->name . '</td>
				<td style="border:1px dotted #D5D5D5;">' . $merchant_name . '</td>
				<td style="border:1px dotted #D5D5D5;" align="center">' . $row->cur_sold_qty . '</td>
				<td style="border:1px dotted #D5D5D5;" align="center">' . $currency_prefix . $row->price . '</td>
				<td style="border:1px dotted #D5D5D5;" align="center">' . $currency_prefix . $total_sales . '</td></tr>';
            $total_amount += $total_sales;
        }
        $result .= '<tr><td style="border:1px dotted #D5D5D5;" colspan="6" style="text-align:right" >Total Amount: </td>
					<td style="border:1px dotted #D5D5D5;" align="center">' . $currency_prefix . $total_amount . '</td></tr></table>';
        //todo
        require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_enmasse' . DS . 'helpers' . DS . 'html2pdf' . DS . 'html2pdf.class.php';
        $html2pdf = new HTML2PDF('P', 'A4', 'en');
        $html2pdf->setDefaultFont('Arial');
        $html2pdf->writeHTML($result);
        $outFileName = 'report-' . DatetimeWrapper::getDateOfNow() . '.pdf';
        $html2pdf->Output($outFileName, 'I');
        die;
    }
コード例 #16
0
ファイル: recette_impression.php プロジェクト: D3Cnet/cuisine
function imprimerRecette($visualisationRecette)
{
    $pageEnCours = '
  <page backtop="15mm" backbottom="7mm" backleft="0mm" backright="0mm" style="font-size: 10pt">

  <page_header>
  	<table border="0" cellpadding="0" cellspacing="0"><col style="width: 15%"><col style="width: 85%">
  		<tr style="background-color:#FFFFFF; color:#363b29; font-size:24pt">
      	  	<td align="left"><img src="images/domonet.png" alt="domoNet" /></td>
      	  	<td align="left"><i>DomoNet</i></td>
      	</tr>
  	</table>
  </page_header>

  <page_footer>
  	<hr style="width: 100%; height: 1px;">
  	<table border="0" cellpadding="0" cellspacing="0"><col style="width: 50%"><col style="width: 50%">
  		<tr>
      	  	<td align="left">' . date('d/m/Y H:i:s') . '</td>
  
        		<td align="right">page [[page_cu]]/[[page_nb]]</td>
      	</tr>
  	</table>
  </page_footer>';
    $pageEnCours .= '<br><br><big style="font-weight: bold; color: rgb(0, 0, 153);"><big><big>' . $visualisationRecette->recette->libelle . '</big></big></big><br><br><label>Classement :&nbsp;' . $visualisationRecette->LireClassement() . '</label><br /><br /><table style="text-align: left; width: 100%; height: 40px;" border="0" cellpadding="2" cellspacing="2">' . '<tbody><tr><td>Difficulté : ' . $visualisationRecette->getDifficulte() . '</td><td>Appréciation : ' . $visualisationRecette->getAppreciation() . '</td></tr><tr><td>Temps de préparation : ' . $visualisationRecette->recette->tempsPreparation . '</td><td>Temps de cuisson : ' . $visualisationRecette->recette->tempsCuisson . '</td></tr></tbody></table><br><span style="font-weight: bold; text-decoration: underline;">Commentaire </span>: <br><br>' . nl2br($visualisationRecette->recette->commentaire) . '<br><br><span style="font-weight: bold; text-decoration: underline;">Ingrédients</span><br><ul>' . $visualisationRecette->LireIngredients() . '</ul><br><span style="text-decoration: underline; font-weight: bold;">Préparation</span><br><br>' . nl2br($visualisationRecette->recette->modePreparation) . '</page>';
    require_once dirname(__FILE__) . '/librairies/html2pdf_v4.01/html2pdf.class.php';
    try {
        $html2pdf = new HTML2PDF('P', 'A4', 'fr');
        // $html2pdf = new HTML2PDF('P','A4', 'fr', false, 'ISO-8859-15', array(10, 10, 15, 10));
        $html2pdf->pdf->SetDisplayMode('fullpage');
        $html2pdf->writeHTML($pageEnCours);
        //  		$html2pdf->Output('export.pdf');
        $html2pdf->Output($visualisationRecette->recette->libelle . '.pdf', 'D');
    } catch (HTML2PDF_exception $e) {
        echo $e;
    }
}
コード例 #17
0
ファイル: js2.php プロジェクト: gasikely2/sgpec
/**
 * HTML2PDF Librairy - example
 *
 * HTML => PDF convertor
 * distributed under the LGPL License
 *
 * @author      Laurent MINGUET <*****@*****.**>
 *
 * isset($_GET['vuehtml']) is not mandatory
 * it allow to display the result in the HTML format
 */
// get the HTML
ob_start();
?>
<page>
    <h1>Test de JavaScript 2</h1><br>
    <br>
    Normalement une alerte devrait apparaitre, indiquant "coucou"
</page>
<?php 
$content = ob_get_clean();
// convert to PDF
try {
    $html2pdf = new HTML2PDF('P', 'A4', 'fr');
    $html2pdf->pdf->IncludeJS("app.alert('coucou');");
    $html2pdf->writeHTML($content, isset($_GET['vuehtml']));
    $html2pdf->Output('js2.pdf');
} catch (HTML2PDF_exception $e) {
    echo $e;
    exit;
}
コード例 #18
0
				<td style=\"width: 20%\">Lab Technologist:</td>
				<td style=\"width: 30%; border-bottom: 1px solid #333\">".($labTechSignature?$labTechSignature:"&nbsp;")."</td>
				<td style=\"width: 20%\">Lab Manager:</td>
				<td style=\"width: 30%; border-bottom: 1px solid #333\">".($labManagerSignature?$labManagerSignature:"&nbsp;")."</td>
			  </tr>
			</table>
		</div>
		<!-- End Sign Offs -->

	</div>
</page>";

//load PDF object
try {
	$html2pdf = new HTML2PDF('P', 'A4', 'fr', true, 'UTF-8', 0);
	$html2pdf->writeHTML($html, isset($_GET['vuehtml']));
	$html2pdf->Output($filename);
}
catch(HTML2PDF_exception $e) {
	echo $e;
	exit;
}

/*
$pdf = new DOMPDF();
$pdf->load_html($html);
$pdf->set_paper("letter", "portrait");
$pdf->render();
//$pdf->outputToFile($filename, array("Attachment" => false));
$pdf->stream($formNumber, array("Attachment" => false));
*/
コード例 #19
0
    <br><br>
    <table border="0">
        <tr>
            <td style="width:70%;"><strong>EMARGEMENT CLIENT</strong></td>
            <td style="width:30%;"><strong>EMARGEMENT SOCIETE</strong></td>
        </tr>
    </table>
    <page_footer>
    <p><strong>N.B</strong> : Ce reçu est délivré sous réserve de l'encaissement du chèque. En cas de rejet pour quelque motif que ce soit, le présent reçu deviendra nul et non avenu.
    Dans la cas de litige, ou la société n’est pas parvenus à la réalisation du projet  le client a le droit de récupérer ses fonds  sans demander une indemnisation ou des intérêts et sans recours au tribunal.
    </p>
    <hr/>
    <p style="text-align: center;font-size: 9pt;">STE GELM SARL : Au capital de 100 000,00 DH – siège social QT 313 Old Brahim Mezanine B1, Nador. 
    	<br>Tèl 0536601818 / 0661668860 IF : 40451179   RC : 10999  Patente 56126681</p>
    </page_footer>
</page>    
<?php 
    $content = ob_get_clean();
    require '../lib/html2pdf/html2pdf.class.php';
    try {
        $pdf = new HTML2PDF('P', 'A4', 'fr');
        $pdf->pdf->SetDisplayMode('fullpage');
        $pdf->writeHTML($content);
        $fileName = "contrat-" . $clientNom . "-" . $biens->nom() . '-' . date('Y-m-d-h-i') . '.pdf';
        $pdf->Output($fileName);
    } catch (HTML2PDF_exception $e) {
        die($e->getMessage());
    }
} else {
    header("Location:index.php");
}
コード例 #20
0
function makePDF()
{
    /**
     * HTML2PDF Librairy - example
     *
     * HTML => PDF convertor
     * distributed under the LGPL License
     *
     * @author      Laurent MINGUET <*****@*****.**>
     *
     * isset($_GET['vuehtml']) is not mandatory
     * it allow to display the result in the HTML format
     */
    // get the HTML
    ob_start();
    include dirname(__FILE__) . '/../nota.php';
    $content = ob_get_clean();
    // convert to PDF
    require_once dirname(__FILE__) . '/../html2pdf.class.php';
    try {
        $html2pdf = new HTML2PDF('P', 'A4', 'en');
        $html2pdf->pdf->SetDisplayMode('fullpage');
        //      $html2pdf->pdf->SetProtection(array('print'), 'spipu');
        $html2pdf->writeHTML($content, isset($_GET['vuehtml']));
        $html2pdf->Output('nota.pdf');
    } catch (HTML2PDF_exception $e) {
        echo $e;
        exit;
    }
}
コード例 #21
0
ファイル: Aps.php プロジェクト: ranvijayj/htmlasa
    /**
     * Generate or regenerate PDF for AP
     * @param $apId
     * @param bool $approved
     * @deprecated since 26.05.2015
     *
     */
    public static function generatePdf($apId, $approved = false)
    {
        // get AP
        $ap = Aps::model()->with('dists', 'document', 'ck_req_detail')->findByPk($apId);

        $ckReqDet = $ap->ck_req_detail;

        // get PO dists
        $apDists = $ap->dists;

        // get PO formatting
        $poFormatting = PoFormatting::model()->findByAttributes(array(
            'Project_ID' => $ap->document->Project_ID,
        ));

        // get Sign_Requested_By user info
        $signRequestedByUser = Users::model()->with('person')->findByPk($ckReqDet->Sign_Requested_By);

        $aproval_detail_list = Audits::getApprovalDetailList($ap->Document_ID);
        // get current vendor info
        $currentVendor = Vendors::model()->with('client.company.adreses')->findByPk($ap->Vendor_ID);

        $condition = UsersClientList::getClientAdminCondition($currentVendor->client->Client_ID);
        $vendorAdmin = UsersClientList::model()->with('user.person')->find($condition);

        // get content for pdf
        $content = Yii::app()->controller->renderPartial('application.views.ap.ap_template', array(
            'ap' => $ap,
            'ckReqDet' => $ckReqDet,
            'poFormatting' => $poFormatting,
            'apDists' => $apDists,
            'currentVendor' => $currentVendor,
            'vendorAdmin' => $vendorAdmin,
            'signRequestedByUser' => $signRequestedByUser,

            'aproval_detail_list' => $aproval_detail_list,

            'approved' => $approved,
        ), true);

        $fileName = Helper::createDirectory('generated_po');
        $fileName = $fileName.'/' . Yii::app()->user->userID . '-' . date("Y_m_d_H_i_s") . '.pdf';
        Yii::import('ext.html2pdf.HTML2PDF');
        $html2pdf = new HTML2PDF('P', 'A4', 'en');
        $html2pdf->writeHTML($content);
        $html2pdf->Output($fileName, 'F');

        // insert or update image image
        $image = Images::model()->findByAttributes(array(
            'Document_ID' => $ap->Document_ID,
        ));

        if (!$image) {
            $image = new Images();
        }

        $imageData = addslashes(fread(fopen($fileName,"rb"),filesize($fileName)));
        $image->Document_ID = $ap->Document_ID;
        $image->Img = $imageData;
        $image->File_Name = Yii::app()->user->userID . '-' . date("Y_m_d_H_i_s") . '.pdf';
        $image->Mime_Type = 'application/pdf';
        $image->File_Hash = sha1_file($fileName);
        $image->File_Size = intval(filesize($fileName));
        $image->Pages_Count = FileModification::calculatePagesByPath($fileName);
        $image->save();

        if (file_exists($fileName)) {
            @unlink($fileName);
        }
    }
コード例 #22
0
    echo '<td>' . $row['sn'] . '</td>';
    echo '<td>' . $d . '</td>';
    echo '<td>' . $row['client'] . '</td>';
    if ($status == 'finished') {
        echo '<td>' . $status . '</td>';
    } else {
        if ($status == 'ongoing') {
            echo '<td>' . $status . '</td>';
        } else {
            if ($status == 'cancelled') {
                echo '<td><span style="color:red;">' . $status . '</span></td>';
            } else {
                if ($status == 'hold') {
                    echo '<td>' . $status . '</td>';
                }
            }
        }
    }
    echo '</tr>';
}
?>
	</tbody>
	</table>
	</page>

	<?php 
$content = ob_get_clean();
require_once 'html2pdf.class.php';
$html2pdf = new HTML2PDF('L', 'Legal', 'fr');
$html2pdf->writeHTML($content);
$html2pdf->output('draftsman_individual_reports.pdf');
コード例 #23
0
ファイル: pdf_presupuesto.php プロジェクト: Izloko89/bichos
                <tr>
                    <td style="width:15%;text-align:center;"></td>
                    <td style="width:10%;"></td>
                    <td style="width:40%;text-align:right;">
                        <strong>Total:</strong>
                    </td>
                    <td style="width:10%;text-align:right;">
                        <strong>' . number_format($total, 2) . '</strong>
                    </td>
                </tr>
            </table>
			
        <table border="0" cellpadding="0" cellspacing="0" style="font-size:13px; width:100%; margin-top:30px; padding:0 20px;">
            <tr>
                <td style="width:100%;vertical-align:top; text-align:center;">
                Atentamente                    
                    <br />______________________                    
                    <br />' . $_SESSION["usuario"] . '    
                </td>
            </tr>
        </table>
    </page>';
} else {
    echo $error;
}
$path = '../docs/';
$filename = "generador.pdf";
$orientar = "portrait";
$topdf = new HTML2PDF($orientar, array($mmCartaW, $mmCartaH), 'es');
$topdf->writeHTML($html);
$topdf->Output();
コード例 #24
0
// This mess generates a PDF report and sends it to the patient.
if (!empty($_POST['form_send_to_portal'])) {
  // Borrowing the general strategy here from custom_report.php.
  // See also: http://wiki.spipu.net/doku.php?id=html2pdf:en:v3:output
  require_once("$srcdir/html2pdf/html2pdf.class.php");
  require_once($GLOBALS["include_root"] . "/cmsportal/portal.inc.php");
  $pdf = new HTML2PDF('P', 'Letter', 'en');
  ob_start();
  echo "<link rel='stylesheet' type='text/css' href='$webserver_root/interface/themes/style_pdf.css'>\n";
  echo "<link rel='stylesheet' type='text/css' href='$webserver_root/library/ESign/css/esign_report.css'>\n";
  $GLOBALS['PATIENT_REPORT_ACTIVE'] = true;
  generate_order_report($orderid, false, true, $finals_only);
  $GLOBALS['PATIENT_REPORT_ACTIVE'] = false;
  // echo ob_get_clean(); exit(); // debugging
  $pdf->writeHTML(ob_get_clean(), false);
  $contents = $pdf->Output('', true);
  // Send message with PDF as attachment.
  $result = cms_portal_call(array(
    'action'   => 'putmessage',
    'user'     => $_POST['form_send_to_portal'],
    'title'    => xl('Your Lab Results'),
    'message'  => xl('Please see the attached PDF.'),
    'filename' => 'results.pdf',
    'mimetype' => 'application/pdf',
    'contents' => base64_encode($contents),
  ));
  if ($result['errmsg']) die(text($result['errmsg']));
}
?>
<html>
コード例 #25
0
 public function generateHtml2pdf($sUID, $aFields, $sPath, $sFilename, $sContent, $sLandscape = false, $aProperties = array())
 {
     // define("MAX_FREE_FRACTION", 1);
     define('PATH_OUTPUT_FILE_DIRECTORY', PATH_HTML . 'files/' . $_SESSION['APPLICATION'] . '/outdocs/');
     G::verifyPath(PATH_OUTPUT_FILE_DIRECTORY, true);
     require_once PATH_THIRDPARTY . 'html2pdf/html2pdf.class.php';
     // define Save file
     $sOutput = 2;
     $sOrientation = $sLandscape == false ? 'P' : 'L';
     $sLang = defined('SYS_LANG') ? SYS_LANG : 'en';
     $sMedia = $aProperties['media'];
     // margin define
     define("MINIMAL_MARGIN", 15);
     $marges = array(MINIMAL_MARGIN, MINIMAL_MARGIN, MINIMAL_MARGIN, MINIMAL_MARGIN);
     if (isset($aProperties['margins'])) {
         // Default marges (left, top, right, bottom)
         $margins = $aProperties['margins'];
         $margins['left'] = $margins['left'] > 0 ? $margins['left'] : MINIMAL_MARGIN;
         $margins['top'] = $margins['top'] > 0 ? $margins['top'] : MINIMAL_MARGIN;
         $margins['right'] = $margins['right'] > 0 ? $margins['right'] : MINIMAL_MARGIN;
         $margins['bottom'] = $margins['bottom'] > 0 ? $margins['bottom'] : MINIMAL_MARGIN;
         $marges = array($margins['left'], $margins['top'], $margins['right'], $margins['bottom']);
     }
     $html2pdf = new HTML2PDF($sOrientation, $sMedia, $sLang, true, 'UTF-8', $marges);
     $html2pdf->pdf->SetAuthor($aFields['USR_USERNAME']);
     $html2pdf->pdf->SetTitle('Processmaker');
     $html2pdf->pdf->SetSubject($sFilename);
     $html2pdf->pdf->SetCompression(true);
     //$html2pdf->pdf->SetKeywords('HTML2PDF, TCPDF, processmaker');
     if (isset($aProperties['pdfSecurity'])) {
         $pdfSecurity = $aProperties['pdfSecurity'];
         $userPass = G::decrypt($pdfSecurity['openPassword'], $sUID);
         $ownerPass = $pdfSecurity['ownerPassword'] != '' ? G::decrypt($pdfSecurity['ownerPassword'], $sUID) : null;
         $permissions = explode("|", $pdfSecurity['permissions']);
         $html2pdf->pdf->SetProtection($permissions, $userPass, $ownerPass);
     }
     $html2pdf->setTestTdInOnePage(false);
     $html2pdf->setTestIsImage(false);
     $html2pdf->setTestIsDeprecated(false);
     $html2pdf->writeHTML($html2pdf->getHtmlFromPage($sContent));
     switch ($sOutput) {
         case 0:
             // Vrew browser
             $html2pdf->Output($sPath . $sFilename . '.pdf', 'I');
             break;
         case 1:
             // Donwnload
             $html2pdf->Output($sPath . $sFilename . '.pdf', 'D');
             break;
         case 2:
             // Save file
             $html2pdf->Output($sPath . $sFilename . '.pdf', 'F');
             break;
     }
     copy($sPath . $sFilename . '.html', PATH_OUTPUT_FILE_DIRECTORY . $sFilename . '.html');
     copy(PATH_OUTPUT_FILE_DIRECTORY . $sFilename . '.pdf', $sPath . $sFilename . '.pdf');
     unlink(PATH_OUTPUT_FILE_DIRECTORY . $sFilename . '.pdf');
     unlink(PATH_OUTPUT_FILE_DIRECTORY . $sFilename . '.html');
 }
コード例 #26
-1
ファイル: Pdf.php プロジェクト: alex63530/thelia
 public function generatePdf(PdfEvent $event)
 {
     $html2pdf = new \HTML2PDF($event->getOrientation(), $event->getFormat(), $event->getLang(), $event->getUnicode(), $event->getEncoding(), $event->getMarges());
     $html2pdf->pdf->SetDisplayMode('real');
     $html2pdf->writeHTML($event->getContent());
     $event->setPdf($html2pdf->output(null, 'S'));
 }
コード例 #27
-1
/**
 * Newscoop article_pdf function plugin
 *
 * Type:     function
 * Name:     article_pdf
 * Purpose:
 *
 * @param array
 *     $params[template]
 *     $params[prefix]
 * @param object
 *     $smarty The Smarty object
 */
function smarty_function_article_pdf($params, &$smarty)
{
    // gets the context variable
    $gimme = $smarty->getTemplateVars('gimme');
    if (isset($params['template'])) {
        $template = $params['template'];
    }
    $pdf_filename = '';
    if (isset($params['prefix'])) {
        $pdf_filename = $params['prefix'] . '-';
    }
    $publish = new DateTime($gimme->article->publish_date);
    $pdf_filename .= 'p' . $publish->format('Ymd') . '-n' . $gimme->article->number . '.pdf';
    $pdf_file = 'public/pdf/' . $pdf_filename;
    if (!file_exists($pdf_file) || $gimme->article->last_update > date('Y-m-d h:i:s', filemtime($pdf_file))) {
        require 'include/html2pdf/html2pdf.class.php';
        try {
            $content = $smarty->fetch($template);
            $html2pdf = new HTML2PDF('P', 'A4', 'de');
            $html2pdf->pdf->SetDisplayMode('real');
            $html2pdf->writeHTML($content);
            $html2pdf->Output($pdf_file, 'F');
        } catch (HTML2PDF_exception $e) {
            return '';
        }
    }
    return $pdf_file;
}
コード例 #28
-1
function convert2pdf($content, $file_name)
{
    if ($file_name == '') {
        $file_name = date('y_m_d_h_m_s') . '.pdf';
    }
    require_once dirname(__FILE__) . '/html2pdf.class.php';
    // get the HTML
    //ob_start();
    //include(dirname(__FILE__).'/about_1.php');
    //$content = ob_get_clean();
    try {
        // init HTML2PDF
        $html2pdf = new HTML2PDF('P', 'A4', 'en', true, 'UTF-8', array(0, 0, 0, 0));
        $html2pdf->setDefaultFont('dejavusans');
        //add this line
        // display the full page
        $html2pdf->pdf->SetDisplayMode('fullpage');
        // convert
        $html2pdf->writeHTML($content, isset($_GET['vuehtml']));
        // add the automatic index
        //$html2pdf->createIndex('Sommaire', 30, 12, false, true, 2);
        // send the PDF
        $html2pdf->Output($file_name);
    } catch (HTML2PDF_exception $e) {
        echo $e;
        exit;
    }
}
コード例 #29
-1
 public static function write($content, $dir)
 {
     try {
         $html2pdf = new HTML2PDF('P', 'A4', 'es');
         $html2pdf->writeHTML($content);
         $html2pdf->Output($dir, 'F');
         return true;
     } catch (Exception $ex) {
         print_r($ex);
         return false;
     }
 }
コード例 #30
-2
ファイル: laporan_pembelian.php プロジェクト: bosokpp1/purlog
 function laporan_pdf_kode($kode_barang)
 {
     $this->load->library('HTML2PDF');
     $html2pdf = new HTML2PDF('L', 'A4', 'fr');
     $html2pdf->setDefaultFont('Arial');
     $data['data_pdf'] = $this->mdl_report_buy->report_buy_pdf_kode($kode_barang);
     $konten = $this->load->view('report_buy/buy_report_kode', $data, true);
     $html2pdf->writeHTML($konten, false);
     $html2pdf->Output("Report_buy" . $kode_barang . ".pdf");
 }