当前位置: 首页>>代码示例>>PHP>>正文


PHP mPDF::SetImportUse方法代码示例

本文整理汇总了PHP中mPDF::SetImportUse方法的典型用法代码示例。如果您正苦于以下问题:PHP mPDF::SetImportUse方法的具体用法?PHP mPDF::SetImportUse怎么用?PHP mPDF::SetImportUse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mPDF的用法示例。


在下文中一共展示了mPDF::SetImportUse方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: merge

 /**
  * @param string $dest
  * @param string[] $files
  * @return bool true, falls min ein Quelldokument verwendbar war
  */
 public static function merge($dest, $files)
 {
     Logging::info('Erzeuge ' . $dest);
     //$dest = Files::validateFilename($dest);
     $pdf = new \mPDF('de-DE', 'A4');
     $pdf->SetImportUse();
     $page = 0;
     foreach ($files as $curFile) {
         Logging::info('Eingangsdatei ' . $curFile);
         if ($curFile == '') {
             continue;
         }
         $pagecount = $pdf->SetSourceFile($curFile);
         if ($page != 0) {
             $pdf->AddPage();
         }
         for ($i = 1; $i <= $pagecount; $i++) {
             $import_page = $pdf->ImportPage($i);
             $pdf->UseTemplate($import_page);
             if ($i < $pagecount) {
                 $pdf->AddPage();
             }
         }
         $page++;
     }
     $pdf->Output($dest, 'F');
     return $page > 0;
 }
开发者ID:new-frontiers,项目名称:nostromo-pdf,代码行数:33,代码来源:PdfPrinter.php

示例2: explodePDF

 /**
  * @param $path
  * @param $print_portrait
  * @param $print_paper_size
  * @param $labels
  * @return bool|string
  */
 public function explodePDF($path, $print_portrait, $print_paper_size, $labels)
 {
     ini_set('memory_limit', '1024M');
     if (!is_file($path)) {
         return false;
     }
     $isPortrait = $print_portrait;
     $paperSize = in_array($print_paper_size, ['A2', 'A3', 'A4', 'A5']) ? $print_paper_size : 'A4';
     $pdfInfo = $this->pdfInfo($path);
     if (!$pdfInfo) {
         return false;
     }
     $pdfSize = array_map(function ($item) {
         return trim((int) $item);
     }, explode('x', $pdfInfo['Page size']));
     $pdfSize['w'] = $pdfSize[0] * 0.75;
     $pdfSize['h'] = $pdfSize[1] * 0.75;
     $paperSizes = ['A2' => ['w' => 420, 'h' => 594], 'A3' => ['w' => 297, 'h' => 420], 'A4' => ['w' => 210, 'h' => 297], 'A5' => ['w' => 148, 'h' => 210]];
     include dirname(__DIR__) . "/lib/mpdf/mpdf.php";
     $mgl = 10;
     $mgr = 10;
     $mgt = 20 + 10;
     $mgb = 5 + 10;
     $mgh = 9;
     $mgf = 9;
     if ($isPortrait) {
         $mgl = 20;
         $mgr = 10;
         $mgt = 5 + 10;
         $mgb = 5 + 10;
         $mgh = 9;
         $mgf = 9;
     }
     $mpdf = new \mPDF('c', $paperSize . ($isPortrait ? '-P' : '-L'));
     $mpdf->SetImportUse();
     $mpdf->SetDisplayMode('fullpage');
     $mpdf->SetCompression(true);
     //$mpdf->SetAutoPageBreak(true);
     $mpdf->mirrorMargins = true;
     $source = $mpdf->SetSourceFile($path);
     $page_w = $isPortrait ? $paperSizes[$paperSize]['w'] : $paperSizes[$paperSize]['h'];
     $page_h = $isPortrait ? $paperSizes[$paperSize]['h'] : $paperSizes[$paperSize]['w'];
     $iter_w = ceil($pdfSize['w'] / $page_w / 2);
     $iter_h = ceil($pdfSize['h'] / $page_h / 1);
     $crop_x = 0;
     $crop_y = 0;
     $head_left = isset($labels['head_left']) ? $labels['head_left'] : '';
     $head_center = isset($labels['head_center']) ? $labels['head_center'] : '';
     $head_right = isset($labels['head_right']) ? $labels['head_right'] : '';
     $footer_left = isset($labels['footer_left']) ? $labels['footer_left'] : '';
     $footer_center = isset($labels['footer_center']) ? $labels['footer_center'] : '';
     $footer_right = isset($labels['footer_right']) ? $labels['footer_right'] : '';
     $header = '
         <table width="100%" style="vertical-align: bottom; font-size: 12pt; font-weight: bold"><tr>
         <td width="33%">' . $head_left . '</td>
         <td width="33%" align="center">' . $head_center . '</td>
         <td width="33%" style="text-align: right;">' . $head_right . '</td>
         </tr></table>
         ';
     $footer = '
         <table width="100%" style="vertical-align: bottom; font-size: 12pt; font-weight: bold"><tr>
         <td width="33%">' . $footer_left . '</td>
         <td width="33%" align="center">' . $footer_center . '</td>
         <td width="33%" style="text-align: right;">' . $footer_right . '</td>
         </tr></table>
         ';
     $mpdf->SetHTMLHeader($header);
     $mpdf->SetHTMLHeader($header, 'E');
     $mpdf->SetHTMLFooter($footer);
     $mpdf->SetHTMLFooter($footer, 'E');
     for ($i = 0; $i < $iter_w; $i++) {
         if ($i > 0) {
             $mpdf->AddPage();
         }
         // '', '', '', '', '', $mgl, $mgr, $mgt, $mgb, $mgh, $mgf
         $tpl = $mpdf->ImportPage($source, $crop_x, $crop_y, $page_w - ($mgl + $mgr), $page_h - ($mgt + $mgb));
         $mpdf->UseTemplate($tpl, $mgl, $mgt);
         if ($iter_h > 2) {
             $mpdf->AddPage();
             $tpl = $mpdf->ImportPage($source, $crop_x, $crop_y, $page_w - ($mgl + $mgr), $page_h - ($mgt + $mgb));
             $mpdf->UseTemplate($tpl, $mgl, $mgt);
         }
         $crop_x += $page_w - ($mgl + $mgr);
     }
     $mpdf->Output($path . 'gen.pdf', 'F');
     return $path . 'gen.pdf';
 }
开发者ID:Werdffelynir,项目名称:owncollab_chart,代码行数:94,代码来源:apicontroller.php

示例3: mPDF

<?php

include_once "../mpdf.php";
$mpdf = new mPDF('', '', '', '', 15, 15, 47, 16, 9, 9);
$mpdf->SetImportUse();
$mpdf->SetDocTemplate('sample_logoheader2.pdf', 1);
// 1|0 to continue after end of document or not - used on matching page numbers
//===================================================
$mpdf->AddPage();
$mpdf->WriteHTML('Hallo World');
$mpdf->AddPage();
$mpdf->WriteHTML('Hallo World');
$mpdf->AddPage();
$mpdf->WriteHTML('Hallo World');
//===================================================
$mpdf->RestartDocTemplate();
//===================================================
$mpdf->AddPage();
$mpdf->WriteHTML('Hallo World');
$mpdf->AddPage();
$mpdf->WriteHTML('Hallo World');
$mpdf->AddPage();
$mpdf->WriteHTML('Hallo World');
//===================================================
$mpdf->Output();
exit;
开发者ID:rromerouchiha,项目名称:quinielas,代码行数:26,代码来源:example42_MPDFI_templatedoc.php

示例4: MakeOverwrittenPDF

 public static function MakeOverwrittenPDF()
 {
     $pdf = new mPDF('');
     $pdf->SetImportUse();
     return $pdf;
 }
开发者ID:appsuite-com-au,项目名称:gossamer,代码行数:6,代码来源:gospdf.php

示例5: add_template

 public static function add_template($pdf_name)
 {
     global $pdf;
     /*
      * Get the page sizes so we can load each page correctly
      * The only way to do this is to initilise and load the PDF, read the sizes and 
      * then correctly initilise the class.
      */
     $pdf_temp = new mPDF();
     $pdf_temp->SetImportUse();
     /* LOAD THE PDF FILE
      * Must be in Acrobat 4.0 (PDF v1.3) format.
      * See manual for more details
      * http://www.setasign.de/support/manuals/fpdi/fpdi/fpdi-setsourcefile/
      */
     $pagecount = $pdf_temp->SetSourceFile($pdf_name);
     /* CREATE A TEMPLATE FOR EACH PDF PAGE 
      * See manual for more details
      * http://www.setasign.de/support/manuals/fpdi/fpdi/fpdi-importpage/	
      */
     for ($i = 1; $i <= $pagecount; $i++) {
         $pdf_load[$i] = $pdf_temp->ImportPage($i);
         $pdf_template_size[$i] = $pdf_temp->useTemplate($pdf_load[$i]);
     }
     /*
      * Set the real object
      */
     $pagecount = $pdf->SetSourceFile($pdf_name);
     for ($i = 1; $i <= $pagecount; $i++) {
         $pdf_load[$i] = $pdf->ImportPage($i);
     }
     return array('load' => $pdf_load, 'size' => $pdf_template_size);
 }
开发者ID:quinntron,项目名称:tmad,代码行数:33,代码来源:plus.php

示例6: mpdf_output

function mpdf_output($wp_content = '', $do_pdf = false, $outputToBrowser = true, $pdfName = '', $templatePath = '')
{
    global $post;
    $pdf_ofilename = $post->post_name . '.pdf';
    if (!empty($pdfName)) {
        $pdf_filename = $pdfName . '.pdf';
    } else {
        $pdf_filename = $pdf_ofilename;
    }
    /**
     * Allow to override the pdf file name
     */
    $pdf_filename = apply_filters('mpdf_output_pdf_filename', $pdf_filename);
    /**
     * Geshi Support
     */
    if (get_option('mpdf_geshi') == true) {
        require_once dirname(__FILE__) . '/geshi.inc.php';
        $wp_content = ParseGeshi($wp_content);
    }
    /**
     * Run the content default filter
     */
    $wp_content = apply_filters('the_content', $wp_content);
    /**
     * Run the mpdf filter
     */
    $wp_content = mpdf_filter($wp_content, $do_pdf);
    if ($do_pdf === false) {
        echo $wp_content;
    } else {
        $cacheDirectory = mpdf_getcachedir();
        if (!is_dir($cacheDirectory . 'tmp')) {
            @mkdir($cacheDirectory . 'tmp');
        }
        define('_MPDF_PATH', dirname(__FILE__) . '/mpdf/');
        define('_MPDF_TEMP_PATH', $cacheDirectory . 'tmp/');
        define('_MPDF_TTFONTDATAPATH', _MPDF_TEMP_PATH);
        require_once _MPDF_PATH . 'mpdf.php';
        global $pdf_margin_left;
        global $pdf_margin_right;
        global $pdf_margin_top;
        global $pdf_margin_bottom;
        global $pdf_margin_header;
        global $pdf_margin_footer;
        global $pdf_html_header;
        global $pdf_html_footer;
        if ($pdf_margin_left !== 0 && $pdf_margin_left == '') {
            $pdf_margin_left = 15;
        }
        if ($pdf_margin_right !== 0 && $pdf_margin_right == '') {
            $pdf_margin_right = 15;
        }
        if ($pdf_margin_top !== 0 && $pdf_margin_top == '') {
            $pdf_margin_top = 16;
        }
        if ($pdf_margin_bottom !== 0 && $pdf_margin_bottom == '') {
            $pdf_margin_bottom = 16;
        }
        if ($pdf_margin_header !== 0 && $pdf_margin_header == '') {
            $pdf_margin_header = 9;
        }
        if ($pdf_margin_footer !== 0 && $pdf_margin_footer == '') {
            $pdf_margin_footer = 9;
        }
        if (empty($pdf_html_header)) {
            $pdf_html_header = false;
        }
        if (empty($pdf_html_footer)) {
            $pdf_html_footer = false;
        }
        global $pdf_orientation;
        if ($pdf_orientation == '') {
            $pdf_orientation = 'P';
        }
        $cp = 'utf-8';
        if (get_option('mpdf_code_page') != '') {
            $cp = get_option('mpdf_code_page');
        }
        $mpdf = new mPDF($cp, 'A4', '', '', $pdf_margin_left, $pdf_margin_right, $pdf_margin_top, $pdf_margin_bottom, $pdf_margin_header, $pdf_margin_footer, $pdf_orientation);
        $mpdf->SetUserRights();
        $mpdf->title2annots = false;
        //$mpdf->annotMargin = 12;
        $mpdf->use_embeddedfonts_1252 = true;
        // false is default
        $mpdf->SetBasePath($templatePath);
        //Set PDF Template if it's set
        global $pdf_template_pdfpage;
        global $pdf_template_pdfpage_page;
        global $pdf_template_pdfdoc;
        if (isset($pdf_template_pdfdoc) && $pdf_template_pdfdoc != '') {
            $mpdf->SetImportUse();
            $mpdf->SetDocTemplate($templatePath . $pdf_template_pdfdoc, true);
        } else {
            if (isset($pdf_template_pdfpage) && $pdf_template_pdfpage != '' && isset($pdf_template_pdfpage_page) && is_numeric($pdf_template_pdfpage_page)) {
                $mpdf->SetImportUse();
                $pagecount = $mpdf->SetSourceFile($templatePath . $pdf_template_pdfpage);
                if ($pdf_template_pdfpage_page < 1) {
                    $pdf_template_pdfpage_page = 1;
                } else {
//.........这里部分代码省略.........
开发者ID:Alinea-Interactive,项目名称:wp-mpdf,代码行数:101,代码来源:wp-mpdf.php

示例7: pdfExport

 function pdfExport($psize = 'Letter', $notes = false, $printAttachments)
 {
     global $thisstaff;
     require_once INCLUDE_DIR . 'class.pdf.php';
     if (!is_string($psize)) {
         if ($_SESSION['PAPER_SIZE']) {
             $psize = $_SESSION['PAPER_SIZE'];
         } elseif (!$thisstaff || !($psize = $thisstaff->getDefaultPaperSize())) {
             $psize = 'Letter';
         }
     }
     $pdfConverterPath = INCLUDE_DIR . 'pdfConverter/';
     $cmd = " find " . $pdfConverterPath . ' -type f -delete';
     shell_exec($cmd);
     $name = 'Ticket.pdf';
     $pdf = new Ticket2PDF($this, $psize, $notes);
     $pdf->Output($pdfConverterPath . $name, 'F');
     $cmd = "chmod -R 777 " . $pdfConverterPath . $name;
     shell_exec($cmd);
     $pdf = new mPDF('c');
     $pdf->allow_charset_conversion = true;
     // Set by default to TRUE
     $pdf->charset_in = 'windows-1252';
     $pdf->SetImportUse();
     $this->importPdfPages($pdf, $pdfConverterPath . $name);
     $attachmentOrder = 1;
     foreach ($printAttachments as $attachmentId) {
         if (!($f = AttachmentFile::lookup(intval($attachmentId)))) {
             break;
         }
         // $this->logErrors($f->getDownloadUrl());
         // $this->logErrors("http://mailtest.spitzeco.dk/".$f->getDownloadUrl());
         if ($fileData = $f->getData()) {
             // $this->logErrors(json_encode($file['data']));
             $timestamp = date("Y-m-d_H");
             $extension = pathinfo($f->getName(), PATHINFO_EXTENSION);
             // $this->logErrors("fileName  ".$f->getName());
             $stringName = preg_replace('/\\s+/', '', $f->getName());
             // $tempName = $timestamp.basename($stringName, '.'.$extension);
             // give the file a temp name in case the file name contians some blank space and then the command would take effect
             $tempName = "tempFile" . $attachmentOrder;
             file_put_contents($pdfConverterPath . $tempName . "." . $extension, $fileData);
             $originalFileName = $pdfConverterPath . $tempName . "." . $extension;
             $formattedFile = $tempName . "formatted.pdf";
             $cmd = "chmod -R 777 " . $pdfConverterPath . $tempName . "." . $extension;
             shell_exec($cmd);
             // this is a command for changing other format to pdf
             $cmd = 'export HOME=/tmp && /usr/bin/libreoffice5.0 --headless --convert-to pdf --outdir ' . $pdfConverterPath . " " . $pdfConverterPath . $tempName . "." . $extension;
             // $this->logErrors("2222222 ".$cmd);
             system($cmd);
             $cmd = "chmod -R 777 " . $pdfConverterPath . $tempName . ".pdf";
             shell_exec($cmd);
             // this command is for making unformatted files become formatted
             $cmd = 'gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=' . $pdfConverterPath . $formattedFile . ' ' . $pdfConverterPath . $tempName . ".pdf";
             shell_exec($cmd);
             $cmd = "chmod -R 777 " . $pdfConverterPath . $formattedFile;
             shell_exec($cmd);
             try {
                 $this->importPdfPages($pdf, $pdfConverterPath . $formattedFile);
                 $cmd = "chmod -R 777 " . $pdfConverterPath . $tempName . ".pdf";
                 shell_exec($cmd);
             } catch (Exception $e) {
                 logErrors('Caught exception: ', $e->getMessage(), "\n");
                 break;
             }
             $attachmentOrder = $attachmentOrder + 1;
         }
     }
     $name = 'Ticket-' . $this->getNumber() . '.pdf';
     $pdf->Output($name, 'I');
     //Remember what the user selected - for autoselect on the next print.
     $_SESSION['PAPER_SIZE'] = $psize;
     exit;
 }
开发者ID:KingsleyGU,项目名称:osticket,代码行数:74,代码来源:class.ticket.php

示例8: setImportUse

 /**
  * turn import using mode on
  * @return \Kohana_MPDF
  */
 public function setImportUse()
 {
     $this->checkMpdfInit();
     $this->mpdf->SetImportUse();
     return $this;
 }
开发者ID:seyfer,项目名称:kohana-mpdf,代码行数:10,代码来源:MPDF.php

示例9: validar_planes

	public function validar_planes($valoracion)
	{
		modules::run('general/is_logged', base_url().'index.php/usuarios/iniciar-sesion');
		$this->load->helper('text');
		
		$view['valoracion'] = $valoracion;
		$val = str_replace('-', ' ', $valoracion);
		$val = ucwords($val);
		$val = str_replace(' ', '-', $val);
		$where = array('ra.valoracion' => $val);
		$view['plan_continuidad'] = $this->riesgos->get_allpcn($where);
		$view['dptos'] = $this->general->get_table('departamento');
		
		if($_POST)
		{
			$this->load->library('mpdf');
			$post = $where = $_POST;
			$pcn = $this->general->get_row('plan_continuidad',array('id_continuidad'=>$post['id_continuidad']),array('denominacion,pdf'));
			$dpto = $this->general->get_row('departamento',array('departamento_id'=>$post['departamento_id']),array('nombre'));
			$personal = $this->general->get_row('personal',array('id_personal'=>$post['id_personal']),array('nombre,cargo'));
			$post['denominacion_pcn'] = $pcn->denominacion;
			$post['nombre_dpto'] = $dpto->nombre;
			$post['nombre_personal'] = $personal->cargo.': '.$personal->nombre;
			$post['fecha_creacion'] = date('Y-m-d H:i:s');
			
			if($this->general->insert('validacion_pcn',$post,$where))
			{
				$validacion = $this->general->get_result('validacion_pcn',array('id_continuidad'=>$post['id_continuidad']));
				foreach($validacion as $key => $valid)
					$ppl[] = '<li>'.$valid->nombre_personal.', el día '.date('d-m-Y',strtotime($valid->fecha_creacion)).'</li>';
				
				$ppl_str = '<ul>'.implode('', $ppl).'</ul>';
		
				$mpdf = new mPDF();
				$mpdf->WriteHTML('<h1>Plan de Continuidad del Negocio VALIDADO</h1><p>El presente PCN fué revisado y validado por:<p>'.$ppl_str);
				$mpdf->SetImportUse(); 
				$pagecount = $mpdf->SetSourceFile($pcn->pdf);
				for($i=1;$i<=$pagecount;$i++)
				{
					$mpdf->AddPage();
					$tplId = $mpdf->ImportPage($i);
					$mpdf->UseTemplate($tplId); 
				}
				unlink($pcn->pdf);
				$mpdf->Output($pcn->pdf,'F');
				$this->session->set_flashdata('alert_success','Plan de Continuidad del Negocio validado con éxito');
			}else
				$this->session->set_flashdata('alert_error','Hubo un error validando el PCN. O ya está validado por '.$personal->nombre);
			
			redirect(site_url('index.php/continuidad/listado_pcn/'.$valoracion));
		}
		
		$breadcrumbs = array
		(
			base_url() => 'Inicio',
			base_url().'index.php/continuidad' => 'Continuidad del Negocio',
			base_url().'index.php/continuidad/seleccionar_listado' => 'Seleccionar Listado',
			base_url().'index.php/continuidad/listado_pcn/'.$valoracion => 'Listado de PCN',
			'#' => 'Validar PCN'
		);
		$view['breadcrumbs'] = breadcrumbs($breadcrumbs);
		
		$this->utils->template($this->_list1(),'continuidad/continuidad/validar_pdf',$view,$this->title,'Validar PCN','two_level');
	}
开发者ID:kelgwiin,项目名称:tesis,代码行数:64,代码来源:continuidad.php

示例10: uploadfile

 public function uploadfile()
 {
     $folder = isset($_GET['folder']) ? $_GET['folder'] : 'others';
     $targetFolder = "/upload_file/{$folder}";
     $prefix = time();
     $setting = $this->general_model->get_email_from_setting();
     $type = explode(",", $setting[0]['download_type']);
     foreach ($type as $key => $value) {
         $type[$key] = strtolower($value);
     }
     $userid = $_SESSION['user']['user_id'];
     if (!empty($_FILES)) {
         $_FILES["Filedata"]["name"] = str_replace(' ', '', $_FILES["Filedata"]["name"]);
         $_FILES["Filedata"]["tmp_name"] = str_replace(' ', '', $_FILES["Filedata"]["tmp_name"]);
         $uploaddatafile1 = md5($_FILES["Filedata"]["name"]);
         $tempFile = $_FILES["Filedata"]["tmp_name"];
         $targetPath = $_SERVER["DOCUMENT_ROOT"] . $targetFolder;
         $targetFile = rtrim($targetPath, "/") . "/" . $_FILES["Filedata"]["name"];
         $fileTypes = $type;
         //array("zip","rar");
         $fileParts = pathinfo($_FILES["Filedata"]["name"]);
         if (in_array(strtolower($fileParts["extension"]), $fileTypes)) {
             move_uploaded_file($tempFile, $targetFile);
             if (isset($_GET['w'])) {
                 $w = $_GET['w'];
             } else {
                 $w = 100;
             }
             if (isset($_GET['h'])) {
                 $h = $_GET['h'];
             } else {
                 $h = 100;
             }
             $path_upload = "upload_file/{$folder}/" . $_FILES["Filedata"]["name"];
             $root = dirname(dirname(dirname(__FILE__)));
             $file = '/' . $path_upload;
             //a reference to the file in reference to the current working directory.
             // Process for image
             $image_info = @getimagesize(base_url() . $path_upload);
             if (!empty($image_info)) {
                 $image = true;
             } else {
                 $image = false;
             }
             if ($image) {
                 if (!isset($_SESSION['fileuploadname'])) {
                     $_SESSION['fileuploadname'] = $_FILES["Filedata"]["name"];
                     $_SESSION['fileuploadhtml'] = '';
                 } else {
                     if (empty($_SESSION['fileuploadname'])) {
                         $_SESSION['fileuploadname'] = $_FILES["Filedata"]["name"];
                         $_SESSION['fileuploadhtml'] = '';
                     }
                 }
                 $_SESSION['fileuploadhtml'] .= '<img src="' . base_url() . $path_upload . '" style="width:850px;"/>';
                 echo "2";
                 exit;
             }
             include $root . "/mpdf/mpdf.php";
             require_once $root . "/scribd.php";
             $scribd_api_key = "766ydp7ellofhr7x027wl";
             $scribd_secret = "sec-7zrz2fxxa2chak965tbp67npqw";
             $scribd = new Scribd($scribd_api_key, $scribd_secret);
             $doc_type = null;
             $access = "private";
             $rev_id = null;
             $data = $scribd->upload($file, $doc_type, $access, $rev_id);
             if (!empty($data)) {
                 $result = 0;
                 while ($result == 0) {
                     echo $result = $scribd->getDownloadLinks($data['doc_id']);
                 }
                 file_put_contents('/upload_file/files/c' . $uploaddatafile1 . ".pdf", fopen($result["download_link"], 'r'));
                 //file_put_contents( fopen($result["download_link"], 'r'));
                 $mpdf = new mPDF();
                 $mpdf->SetImportUse();
                 $pagecount = $mpdf->SetSourceFile('/upload_file/files/r' . $uploaddatafile1 . ".pdf");
                 $tplId = $mpdf->ImportPage(1);
                 $mpdf->UseTemplate($tplId);
                 $mpdf->SetDisplayMode('fullpage');
                 $mpdf->SetWatermarkText(' ');
                 $mpdf->watermark_font = 'DejaVuSansCondensed';
                 $mpdf->showWatermarkText = true;
                 $md5 = $uploaddatafile1;
                 $mpdf->Output('/upload_file/files/' . $md5 . '.pdf', '');
                 $mpdf->Thumbnail('/upload_file/files/' . $md5 . '.pdf', 1);
                 $mpdf->Output('/upload_file/files/' . $md5 . '.pdf', '');
                 unlink('/upload_file/files/c' . $uploaddatafile1 . ".pdf");
                 $im = new imagick();
                 $im->readimage('/upload_file/files/' . $md5 . '.pdf');
                 //$im->readimage('/upload_file/files/'.$md5.'.pdf');
                 $im->setImageCompressionQuality(0);
                 $im->setImageFormat('jpeg');
                 $im->writeImage('/upload_file/images/r' . $md5 . '.jpg');
                 $this->db->set('id', $userid);
                 $this->db->set('fullpdf', '/upload_file/files/r' . $uploaddatafile1 . '.pdf');
                 $this->db->set('pdf', '/upload_file/files/' . $md5 . '.pdf');
                 $this->db->set('image', '/upload_file/images/r' . $md5 . '.jpg');
                 $this->db->insert('scribe');
                 $im->clear();
//.........这里部分代码省略.........
开发者ID:kuldeepro,项目名称:notesgen,代码行数:101,代码来源:pages.php

示例11: process

 public function process(Vtiger_Request $request)
 {
     $response = new Vtiger_Response();
     $debug_fs = "";
     $reportsDeleteDenied = array();
     $ReportsTempDirectory = "test/ITS4YouReports/";
     //$path_fix = "../../../";
     $path_fix = "";
     //$filename = $path_fix."test/ITS4YouReports/".$_REQUEST["filename"].".pdf";
     $file_path = $_REQUEST["filepath"];
     // "test/$filename.png"
     if (is_writable($path_fix . $ReportsTempDirectory)) {
         if (isset($_REQUEST["canvasData"]) && $_REQUEST["canvasData"] != "") {
             $unencodedData = $_REQUEST["canvasData"];
             file_put_contents($path_fix . $file_path, base64_decode($unencodedData));
         }
         if (isset($_REQUEST["mode"]) && $_REQUEST["mode"] == "download") {
             if (file_exists($path_fix . 'modules/PDFMaker/resources/mpdf/mpdf.php')) {
                 require_once $path_fix . 'modules/PDFMaker/resources/mpdf/mpdf.php';
                 $export_pdf_format = $_REQUEST['export_pdf_format'];
                 $mpdf = new mPDF('utf-8', "{$export_pdf_format}", "", "", "5", "5", "0", "5", "5", "5");
                 $mpdf->keep_table_proportions = true;
                 $mpdf->SetAutoFont();
                 $filename = $ReportsTempDirectory . $_REQUEST['report_filename'];
                 $filename = html_entity_decode($filename, ENT_COMPAT, $default_charset);
                 $filename = $path_fix . $filename;
                 if (is_file($filename)) {
                     $mpdf->AddPage();
                     $mpdf->SetImportUse();
                     $pagecount = $mpdf->SetSourceFile($filename);
                     if ($pagecount > 0) {
                         for ($i = 1; $i <= $pagecount; $i++) {
                             $tplId = $mpdf->ImportPage($i);
                             $mpdf->UseTemplate($tplId);
                             if ($i < $pagecount) {
                                 $mpdf->AddPage();
                             }
                         }
                     }
                     if (file_exists($path_fix . $file_path) == true) {
                         $mpdf->AddPage('L');
                         $ch_image_html .= "<div style='width:100%;text-align:center;'><table class='rptTable' style='border:0px;padding:0px;margin:auto;width:80%;text-align:center;' cellpadding='5' cellspacing='0' align='center'>\n    \t\t                            <tr>\n    \t\t                                <td class='rpt4youGrpHead0' nowrap='' >";
                         $ch_image_html .= "<img src='{$site_URL}" . $file_path . "' />";
                         $ch_image_html .= "</td>\n    \t\t                            </tr>\n    \t\t                        </table></div>";
                         $mpdf->WriteHTML($ch_image_html);
                     }
                     //$mpdf->Output($filename,'F');
                     $mpdf->Output($_REQUEST['report_filename'], 'D');
                 }
             }
         }
     }
     //$response->setResult(array("done-P"));
     //$response->emit();
 }
开发者ID:cin-system,项目名称:cinrepo,代码行数:55,代码来源:SaveImage.php

示例12: writeByMpdf

        private function writeByMpdf(){
            $tmpfile = 'logs/temp_' . str_replace('/', '_', $this->invNO)  . '.pdf';
            $this->Output($tmpfile,'F');
            include_once ('mpdf/mpdf.php');
            $mpdf=new \mPDF('','','','',15,15,57,16,9,9); 

            $mpdf->SetImportUse();
            $mpdf->SetDisplayMode('fullpage');
            $mpdf->SetCompression(false);
            $pagecount = $mpdf->SetSourceFile($tmpfile);
            for ($i=1; $i<=$pagecount; $i++) {
                $tplIdx = $mpdf->ImportPage($i);
                $mpdf->UseTemplate($tplIdx);
                if ($i < $pagecount)
                    $pdf->AddPage($this->orientaion);
            }
            $mpdf->Output();
            unlink($tmpfile);
//            $newfile = $this->invNO . '.pdf';
//            $mpdf->Output($newfile, 'I');
        }
开发者ID:Rajagunasekaran,项目名称:BACKUP,代码行数:21,代码来源:InvoicePDF.php


注:本文中的mPDF::SetImportUse方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。