本文整理汇总了PHP中mPDF::SetHeader方法的典型用法代码示例。如果您正苦于以下问题:PHP mPDF::SetHeader方法的具体用法?PHP mPDF::SetHeader怎么用?PHP mPDF::SetHeader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mPDF
的用法示例。
在下文中一共展示了mPDF::SetHeader方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ActionCreatePDF
public function ActionCreatePDF($id)
{
$mpdf = Yii::app()->ePdf->mpdf();
$model_historia = $this->loadModel($id);
$model_historiaO_paciente = HistoriaObstetricia::model()->getHistoriasObstetriciaByPaciente($model_historia->paciente->id);
$model_historiaG_paciente = HistoriaGinecologia::model()->getHistoriasGinecologicasByPaciente($model_historia->paciente->id);
$historia = array($model_historiaG_paciente, $model_historiaO_paciente);
$stylesheet = file_get_contents('C:\\wamp\\www\\Gineobs\\themes\\hebo\\css\\pdfMain.css');
//configurando pdf general
$mpdf = new mPDF('utf-8', 'Letter-L');
//agregando header y footer
$mpdf->SetHeader('{DATE j-m-Y}||Recipe #' . $model_historia->paciente->id);
$mpdf->SetFooter('Dr. María Hernández|Ginecologia y obstetricia|{PAGENO}');
//Propiedades del PDF
$mpdf->setTitle("Historia Medica");
$mpdf->setAuthor("María Hernández");
$mpdf->setCreator("Edgar Cardona y Gabriela Soto");
$mpdf->setSubject("Historia medica de pacientes.");
$mpdf->setKeywords("Historia,Medicina");
//escribiendo CSS
$mpdf->WriteHTML($stylesheet, 1);
//Escribiendo PDF
$mpdf->writeHTML($this->renderPartial('historia', array('model' => $model_historia->paciente->id, 'historia' => $historia), true), 2);
//Salida
$mpdf->output("Recipe Medico", EYiiPdf::OUTPUT_TO_DOWNLOAD);
}
示例2: GerarPdf
public static function GerarPdf($html, $titulo = null, $paisagem = false, $nomePdf = null)
{
$mpdf = new mPDF();
$mpdf->allow_charset_conversion = true;
$mpdf->charset_in = 'utf-8';
if ($paisagem == true) {
$mpdf->CurOrientation = 'l';
}
//Exibir a pagina inteira no browser
//$mpdf->SetDisplayMode('fullpage');
//Cabeçalho: Seta a data/hora completa de quando o PDF foi gerado + um texto no lado direito
if ($titulo != null) {
$mpdf->SetHeader("{$titulo}");
}
//Rodapé: Seta a data/hora completa de quando o PDF foi gerado + um texto no lado direito
$mpdf->SetFooter("{DATE j/m/Y H:i}|{PAGENO}/{nb}| {$titulo}");
$mpdf->WriteHTML($html);
// define um nome para o arquivo PDF
if ($nomePdf == null) {
$nomePdf = time() . '.pdf';
}
$mpdf->Output($nomePdf, 'I');
}
示例3: pdf
function pdf($html, $filename = null, $cabecalho = '', $rodape = '')
{
require APPPATH . "helpers/mpdf/mpdf.php";
$mpdf = new mPDF();
//$mpdf->allow_charset_conversion=true;
$mpdf->charset_in = 'utf-8';
//Exibir a pagina inteira no browser
$mpdf->SetDisplayMode('fullpage');
//Cabeçalho: Seta a data/hora completa de quando o PDF foi gerado + um texto no lado direito
if ($cabecalho !== '') {
$mpdf->SetHeader('{DATE j/m/Y H:i}| | ' . $cabecalho);
}
//Rodapé: Seta a data/hora completa de quando o PDF foi gerado + um texto no lado direito
if ($rodape !== '') {
$mpdf->SetFooter($rodape);
}
$mpdf->WriteHTML($html);
// define um nome para o arquivo PDF
if ($filename == null) {
$filename = date("Y-m-d_his") . '_impressao.pdf';
}
$mpdf->Output($filename, 'I');
}
示例4: laba_rugi_download
//.........这里部分代码省略.........
for ($branch = 0; $branch <= $total_branch; $branch++) {
$account_5090001_debet[$branch] = $this->jurnal_model->sum_account_debet_by_date($code, $date_start, $date_end, $branch);
$account_5090001_credit[$branch] = $this->jurnal_model->sum_account_credit_by_date($code, $date_start, $date_end, $branch);
$account_5090001[$branch] = $account_5090001_debet[$branch] - $account_5090001_credit[$branch];
$account_5090001_total += $account_5090001[$branch];
$account_beban_lain_total[$branch] += $account_5090001[$branch];
$account_beban_diluar_usaha_total[$branch] += $account_5090001[$branch];
}
$code = "5090002";
for ($branch = 0; $branch <= $total_branch; $branch++) {
$account_5090002_debet[$branch] = $this->jurnal_model->sum_account_debet_by_date($code, $date_start, $date_end, $branch);
$account_5090002_credit[$branch] = $this->jurnal_model->sum_account_credit_by_date($code, $date_start, $date_end, $branch);
$account_5090002[$branch] = $account_5090002_debet[$branch] - $account_5090002_credit[$branch];
$account_5090002_total += $account_5090002[$branch];
$account_beban_lain_total[$branch] += $account_5090002[$branch];
$account_beban_diluar_usaha_total[$branch] += $account_5090002[$branch];
}
$code = "5090005";
for ($branch = 0; $branch <= $total_branch; $branch++) {
$account_5090005_debet[$branch] = $this->jurnal_model->sum_account_debet_by_date($code, $date_start, $date_end, $branch);
$account_5090005_credit[$branch] = $this->jurnal_model->sum_account_credit_by_date($code, $date_start, $date_end, $branch);
$account_5090005[$branch] = $account_5090005_debet[$branch] - $account_5090005_credit[$branch];
$account_5090005_total += $account_5090005[$branch];
$account_beban_lain_total[$branch] += $account_5090005[$branch];
$account_beban_diluar_usaha_total[$branch] += $account_5090005[$branch];
}
$account_beban_lain_konsolidasi = $account_5050001_total + $account_5050002_total + $account_5050005_total + $account_5090001_total + $account_5090002_total + $account_5090005_total;
$print .= ' <tr><td align="left" > Beban Lainnya</td>';
$print .= ' <td align="right" class="border_btm">' . ($account_beban_lain_konsolidasi < 0 ? "(" . number_format(abs($account_beban_lain_konsolidasi)) . ")" : number_format($account_beban_lain_konsolidasi)) . '</td>';
for ($branch = 0; $branch <= $total_branch; $branch++) {
$print .= ' <td align="right" class="border_btm">' . ($account_beban_lain_total[$branch] < 0 ? "(" . number_format(abs($account_beban_lain_total[$branch])) . ")" : number_format($account_beban_lain_total[$branch])) . '</td>';
}
$print .= '</tr>';
//Total Beban Diluar Usaha
for ($branch = 0; $branch <= $total_branch; $branch++) {
$account_beban_diluar_usaha_konsolidasi += $account_beban_diluar_usaha_total[$branch];
}
$print .= ' <tr><td align="left" > Total Beban Diluar Usaha</td>';
$print .= ' <td align="right" class="border_btm">' . ($account_beban_diluar_usaha_konsolidasi < 0 ? "(" . number_format(abs($account_beban_diluar_usaha_konsolidasi)) . ")" : number_format($account_beban_diluar_usaha_konsolidasi)) . '</td>';
for ($branch = 0; $branch <= $total_branch; $branch++) {
$print .= ' <td align="right" class="border_btm">' . ($account_beban_diluar_usaha_total[$branch] < 0 ? "(" . number_format(abs($account_beban_diluar_usaha_total[$branch])) . ")" : number_format($account_beban_diluar_usaha_total[$branch])) . '</td>';
}
$print .= '</tr>';
$print .= ' <tr><td></td><td align="left" colspan="' . $colspan . '" class="border_btm"> </td></tr>';
//---------------------------------------------------------------------------------------------
//Laba (Rugi) TOTAL
//---------------------------------------------------------------------------------------------
//Laba (Rugi) Sebelum Pajak
$account_LR_sebelum_pajak_konsolidasi = $account_LR_operasi_konsolidasi + $account_pendapatan_diluar_usaha_konsolidasi - $account_beban_diluar_usaha_konsolidasi;
$print .= ' <tr><td align="left" ><b>Laba (Rugi) Sebelum Pajak</b></td>';
$print .= ' <td align="right" class="border_btm"><b>' . ($account_LR_sebelum_pajak_konsolidasi < 0 ? "(" . number_format(abs($account_LR_sebelum_pajak_konsolidasi)) . ")" : number_format($account_LR_sebelum_pajak_konsolidasi)) . '</b></td>';
for ($branch = 0; $branch <= $total_branch; $branch++) {
$account_LR_sebelum_pajak[$branch] = $account_LR_operasi_total[$branch] + $account_pendapatan_diluar_usaha_total[$branch] - $account_beban_diluar_usaha_total[$branch];
$print .= ' <td align="right" class="border_btm"><b>' . ($account_LR_sebelum_pajak[$branch] < 0 ? "(" . number_format(abs($account_LR_sebelum_pajak[$branch])) . ")" : number_format($account_LR_sebelum_pajak[$branch])) . '</b></td>';
}
$print .= '</tr>';
$print .= ' <tr><td></td><td align="left" colspan="' . $colspan . '" class="border_btm"></td></tr>';
//Pajak Penghasilan Badan
$code = "5050004";
for ($branch = 0; $branch <= $total_branch; $branch++) {
//$account_5050004_debet[$branch] = $this->jurnal_model->sum_account_debet_by_date($code,$date_start,$date_end,$branch);
//$account_5050004_credit[$branch] = $this->jurnal_model->sum_account_credit_by_date($code,$date_start,$date_end,$branch);
//$account_5050004[$branch] = $account_5050004_debet[$branch] - $account_5050004_credit[$branch];
$account_5050004[$branch] = 0;
$account_5050004_total += $account_5050004[$branch];
}
$print .= ' <tr><td align="left" > Pajak Penghasilan Badan</td>';
$print .= ' <td align="right" class="border_btm">' . ($account_5050004_total < 0 ? "(" . number_format(abs($account_5050004_total)) . ")" : number_format($account_5050004_total)) . '</td>';
for ($branch = 0; $branch <= $total_branch; $branch++) {
$print .= ' <td align="right" class="border_btm">' . ($account_5050004[$branch] < 0 ? "(" . number_format(abs($account_5050004[$branch])) . ")" : number_format($account_5050004[$branch])) . '</td>';
}
$print .= '</tr>';
$print .= ' <tr><td></td><td align="left" colspan="' . $colspan . '" class="border_btm"></td></tr>';
//Laba (Rugi) Bersih
$account_LR_bersih_konsolidasi = $account_LR_sebelum_pajak_konsolidasi - $account_5050004_total;
$print .= ' <tr><td align="left" ><b>Laba (Rugi) Bersih</b></td>';
$print .= ' <td align="right" class="border_btm"><b>' . ($account_LR_bersih_konsolidasi < 0 ? "(" . number_format(abs($account_LR_bersih_konsolidasi)) . ")" : number_format($account_LR_bersih_konsolidasi)) . '</b></td>';
for ($branch = 0; $branch <= $total_branch; $branch++) {
$account_LR_bersih_total[$branch] = $account_LR_sebelum_pajak[$branch] - $account_5050004[$branch];
$print .= ' <td align="right" class="border_btm"><b>' . ($account_LR_bersih_total[$branch] < 0 ? "(" . number_format(abs($account_LR_bersih_total[$branch])) . ")" : number_format($account_LR_bersih_total[$branch])) . '</b></td>';
}
$print .= '</tr>';
$print .= '</table>';
$html .= $print;
$this->load->library('mpdf');
$mpdf = new mPDF('utf-8', 'A4-L');
$mpdf->SetHeader("Amartha Microfinance" . '||' . $tgl . '|');
$mpdf->SetFooter("Laporan Laba Rugi" . '||{PAGENO}|');
$mpdf->WriteHTML($html);
//echo $html;
//$this->mpdf->Output();
$pdfFilePath = FCPATH . "downloads/labarugi/{$filename}.pdf";
$pdffile = base_url() . "downloads/labarugi/{$filename}.pdf";
$mpdf->Output($pdfFilePath, 'F');
redirect($pdffile, 'refresh');
} else {
//If no session, redirect to login page
redirect('login', 'refresh');
}
}
示例5: mPDF
1<br>
1<br>
1<br>
1<br>
1<br>
1<br>
1<br>
1<br>
1<br>
1<br>
1<br>
1<br>
';
//==============================================================
//==============================================================
//==============================================================
include "../mpdf.php";
$mpdf = new mPDF('c', 'A4', '', '', 5, 5, 5, 5, 0, 0);
$mpdf->mirrorMargins = 1;
// Use different Odd/Even headers and footers and mirror margins (1 or 0)
//$mpdf->SetDisplayMode('fullpage','two');
// LOAD a stylesheet
$stylesheet = file_get_contents('mpdfstylePaged.css');
//$mpdf->WriteHTML($stylesheet,1); // The parameter 1 tells that this is css/style only and no body/html/text
$mpdf->SetHeader('<b style="text-align:left">Document Title {PAGENO}<b>');
$mpdf->WriteHTML('Document text');
$mpdf->WriteHTML($html);
$mpdf->Output();
exit;
//==============================================================
//==============================================================
示例6: mPDF
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Primary Author Contact: Jacob Bates <jacob.bates@ucf.edu>
*/
require '../vendor/autoload.php';
use zz\Html\HTMLMinify;
ini_set('max_execution_time', 300);
$pdf = new mPDF();
$stylesheet = <<<EOD
<link rel="stylesheet" href="../assets/css/pdf.css" type="text/css">
EOD;
session_start();
$title = $_POST['context_title'];
session_write_close();
$html = HTMLMinify::minify($_POST['result_html']);
$pdf->SetHeader("Scanned on " . date("m/d/Y") . " at " . date("g:i a"));
$pdf->SetFooter("Page {PAGENO} / {nb}");
$pdf->WriteHTML($stylesheet, 1);
$pdf->WriteHTML($html, 2);
$pdf->Output($title . '_' . date("Y-m-d_g:i-a") . '.pdf', 'D');
exit;
示例7: mPDF
<?php
/*********************************************************************/
/*Generar el reporte del dia, todos los tours */
/* */
/*********************************************************************/
$hotel = $_GET['hotel'];
$table_header = "";
include "../mpdf/mpdf.php";
$mpdf = new mPDF(”);
//the table stylesheet
$stylesheet = file_get_contents('../mpdf/examples/mpdfstyletables.css');
$mpdf->WriteHTML($stylesheet, 1);
//$mpdf->useDefaultCSS2 = true;
//set header and footer to the pdf
$mpdf->SetHeader('{DATE j-m-Y h:i:s}| <h5>Operadora Zacatecas S.A de C.V<h5> |{PAGENO}');
$mpdf->SetFooter('|Operadora|');
$mpdf->WriteHTML('<br/>');
$texto = "ERROR: ";
//archivo de configuracion
include 'config.php';
$mysqli = new mysqli($hostdb, $usuariodb, $clavedb, $nombredb);
/* comprobar la conexión */
if (mysqli_connect_errno()) {
echo $texto . mysqli_connect_error();
/**printf("Falló la conexión: %s\n", mysqli_connect_error());**/
exit;
}
//Consultar todos los hoteles activos en la base de datos
//Esta consulta carga la clave de los hoteles
//$consulta = 'SELECT th.id_tour, t.nombre_tour, th.horario, t.numero_tour FROM tourhorario th, tours t WHERE th.id_tour = t.id_tour';
示例8: pdfReportAction
public function pdfReportAction(Request $request)
{
$html = $request->getSession()->get('pdf');
//$html = utf8_encode($html);
$mpdf = new \mPDF();
//$mpdf->WriteHTML('<pagebreak sheet-size="A5-L" />');
//$L = "L";
//$mpdf->_setPageSize("A4",$L);
$mpdf->defaultheaderfontsize = 10;
/* in pts */
$mpdf->defaultheaderfontstyle = B;
/* blank, B, I, or BI */
$mpdf->defaultheaderline = 1;
/* 1 to include line below header/above footer */
$mpdf->defaultfooterfontsize = 12;
/* in pts */
$mpdf->defaultfooterfontstyle = B;
/* blank, B, I, or BI */
$mpdf->defaultfooterline = 1;
/* 1 to include line below header/above footer */
$mpdf->SetHeader('{DATE j-m-Y}|{PAGENO}|Reportes SISCONEE');
$mpdf->SetFooter('{PAGENO}');
/* defines footer for Odd and Even Pages - placed at Outer margin */
$mpdf->WriteHTML($html);
$mpdf->Output();
exit;
}
示例9: mPDF
$fooder .= "<tr>";
$fooder .= "<td>";
$fooder .= "<b>Matriz:</b> Av. Santos Dumont, 1504 Km 01 da Estrada do Coco, Itinga - Lauro de Freitas - Bahia ";
$fooder .= "Tel: (71) 3450-5686 <br>";
$fooder .= "<b>Filial Feira de Santana: </b>Pça João Pedreira, 24, Edf. Antônio Pinto Sala 201, Centro - Feira de Santana - Bahia CEP:44.002-168 ";
$fooder .= "Tel: (75) 3223-4279 <br>";
$fooder .= "<b>Filial Salvador:</b> Rua Lucaia, 03, Rio Vermelho- Salvador, Bahia-CEP:41.940-650";
$fooder .= "Tel: (71) 3018-5686 <br>";
$fooder .= "</td>";
$fooder .= "</tr>";
$fooder .= "<tr>";
$fooder .= "<td align=\"center\" >";
$fooder .= "www ciderh.org.br <br>";
$fooder .= "<font color=\"#AB3156\"><b>CIDE - 17 Anos Intermediando o seu Desenvolvimento</b></font>";
$fooder .= "</td>";
$fooder .= "</tr>";
$fooder .= "</table>";
$mpdf=new mPDF();
$mpdf->SetHeader($header);
$mpdf->SetFooter($fooder);
$mpdf->SetDisplayMode('fullpage');
$css = file_get_contents("estilo_termo_adtivo.css");
$mpdf->WriteHTML($css,1);
$mpdf->WriteHTML($html);
$mpdf->Output();
exit;
finalizar();
?>
示例10: mPDF
* print to a web browser
*/
//echo '<!DOCTYPE html><html><head><meta charset="UTF-8">' . $this->var_('style') . '</head><body>' . $headCont . $subHeader . $cont . '</body></html>';
//exit();
/**
* Create a new PDF document
*
* @param string $mode
* @param string $format
* @param int $font_size
* @param string $font
* @param int $margin_left
* @param int $margin_right
* @param int $margin_top (Margin between content and header, not to be mixed with margin_header - which is document margin)
* @param int $margin_bottom (Margin between content and footer, not to be mixed with margin_footer - which is document margin)
* @param int $margin_header
* @param int $margin_footer
* @param string $orientation (P, L)
new mPDF($mode, $format, $font_size, $font, $margin_left, $margin_right, $margin_top, $margin_bottom, $margin_header, $margin_footer, $orientation);
default : $mode='',$format='A4',$default_font_size=0,$default_font='',$mgl=15,$mgr=15,$mgt=16,$mgb=16,$mgh=9,$mgf=9, $orientation='P'
* * */
$mpdf = new mPDF('', 'A4', 0, '', 15, 15, 24, 16, 9, 9, 'P');
$mpdf->simpleTables = true;
$mpdf->useSubstitutions = false;
// true/ false
$mpdf->defaultheaderline = 0;
$mpdf->SetHeader(\GLOBALVAR\ROOT . '|MZE, VÚMOP v.v.i.|Generováno dne: {DATE d.m.Y}');
$mpdf->setAutoTopMargin = 5;
$mpdf->SetFooter('|{PAGENO}.|');
$mpdf->WriteHTML('<!DOCTYPE html><html><head><meta charset="UTF-8">' . $this->var_('style') . '</head><body>' . $headCont . $subHeader . $cont . '</body></html>');
$mpdf->Output('REPORT_eKalkulacka.pdf', 'I');
示例11: mPDF
$html .= "<td colspan=\"2\"><span class=\"style5\">ESTAGIÁRIO(A)</span></td>";
$html .= "<td colspan=\"2\"> </td>";
$html .= "</tr>";
$html .= "<tr align=\"left\" valign=\"top\">";
$html .= "<td colspan=\"4\"><span class=\"style6\">Nome do Estagiário:";
$html .=strtoupper($lineDados['nome']);
$html .= "</tr>";
$html .= "</table>";
$mpdf=new mPDF();
$mpdf->SetHeader('teste');
$mpdf->SetDisplayMode('fullpage');
$css = file_get_contents("estilo_pdf.css");
$mpdf->WriteHTML($css,1);
$mpdf->WriteHTML($html);
$mpdf->Output();
exit;
?>
</span></td></tr>
<tr align="left" valign="top">
<td colspan="2"><span class="style6">RG:
<?php
echo $lineDados['rg'];
?>
</span></td>
示例12: if
$appendTable .="<td>".$row[$x]."</td>";}
else if($flag != 3){
$appendTable .="<td>".$row[$x]."</td>";
}}
}
$appendTable .='</tr>';
}
$appendTable .='</tbody></table>';
//DROP TEMP TABLE
$drop_query="DROP TABLE $temp_table ";
if(($flag==3)||($flag==5)||($flag==6)||($flag==7)||($flag==8)||($flag==9)||($flag==10)||($flag==11)||($flag==12)||($flag==13)||($flag==14)||($flag==15))
mysqli_query($con,$drop_query);
//GENERATE PDF
$pageWidth=$arrTableWidth[$flag]/4;
$mpdf=new mPDF('utf-8', array($pageWidth,236));
$mpdf->SetHeader($_GET['title']);
$mpdf->WriteHTML($appendTable);
$outputpdf=$mpdf->Output($_GET['title'].'.pdf','d');
echo $outputpdf;
?>
<!--
1*******USER DETAIL SEARCH
2*******
3*******TICKLER HISTORY
4*******DOOR CODE ACCES
5,6,7,8,9*******REVENUE
10******PROJECT REVENUE DATE RANGE
11******ATTENDANCE PRE ABS COUNT
12******ATTENDANCE PR ABS CNT BY MONTH
13******ATTENDANCE REPORT ENTRY MISSED
14******BANDWIDTH
示例13: mpdf
/**
* @param $url string - address of the item to print as PDF
* @return string - contents of the PDF
*/
private function mpdf($url)
{
if (!extension_loaded('curl')) {
TikiLib::lib('reporterror')->report(tra('mPDF: CURL PHP extension not available'));
return '';
}
// To prevent anyone else using your script to create their PDF files - TODO?
//if (!preg_match("/^$base_url/", $url)) { die("Access denied"); }
/* FIXME later, cookie auth not working yet
$cookie = [];
foreach ($_COOKIE as $key => $value) {
$cookie[] = "{$key}={$value}";
};
$cookie = implode(';', $cookie);
$ckfile = tempnam("/tmp", 'curl_cookies_');
file_put_contents($ckfile, $cookie);
$curl_log = fopen('temp/curl_debug.txt', 'w+'); // open file for READ and write
*/
$options = array(CURLOPT_RETURNTRANSFER => true, CURLOPT_HEADER => false, CURLINFO_HEADER_OUT => true, CURLOPT_ENCODING => "", CURLOPT_HTTPHEADER => ['Expect:'], CURLOPT_FOLLOWLOCATION => true, CURLOPT_AUTOREFERER => true, CURLOPT_MAXREDIRS => 10, CURLOPT_CONNECTTIMEOUT => 10, CURLOPT_TIMEOUT => 30, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1);
// For $_POST i.e. forms with fields
if (count($_POST) > 0) {
$ch = curl_init($url);
curl_setopt_array($ch, $options);
$formvars = [];
foreach ($_POST as $name => $post) {
$formvars = [$name => $post . " \n"];
}
curl_setopt($ch, CURLOPT_POSTFIELDS, $formvars);
$html = curl_exec($ch);
curl_close($ch);
} else {
$ch = curl_init($url);
curl_setopt_array($ch, $options);
$html = curl_exec($ch);
curl_close($ch);
if (!$html) {
$err = curl_error($ch);
TikiLib::lib('errorreport')->report($err ? $err : tr('mPDF: An error occurred retrieving page %0', $url));
return '';
}
}
include $this->location . 'mpdf.php';
$mpdf = new mPDF('');
$mpdf->useSubstitutions = true;
// optional - just as an example
$mpdf->SetHeader($url . '||Page {PAGENO}');
// optional - just as an example
$mpdf->CSSselectMedia = 'print';
// assuming you used this in the document header
$mpdf->autoScriptToLang = true;
$mpdf->autoLangToFont = true;
$mpdf->setBasePath($url);
$mpdf->WriteHTML($html);
return $mpdf->Output('', 'S');
// Return as a string
}
示例14: PrintPDF
public static function PrintPDF($args)
{
$html = $args;
//$name = $args["name"];
//$css = $args["css"];
include "Lib/PDF/mpdf.php";
$pdf = new mPDF("utf-8");
$pdf->SetHeader("Lapa");
$pdf->setFooter("{PAGENO}");
$pdf->useOnlyCoreFonts = true;
$pdf->SetDisplayMode("fullpage");
$pdf->WriteHTML($html);
$pdf->Output('page.pdf', 'F');
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
header("Content-Type: application/pdf");
header('Content-Disposition: attachment; filename="http://arthurvershinin.id.lv/page.pdf"');
exit("http://arthurvershinin.id.lv/page.pdf");
}
示例15: SinglePage
if ($i % 3 == 1) {
$html = $html2;
} else {
$html = $html1;
}
$pph[$i] = SinglePage($html, $pw, $ph, $minK);
// $pph saves the actual height of each page
}
//==============================================================
// Save the pages to a file
$mpdf->Output('test.pdf', 'F');
// Now collate those pages using IMPORT - 4 pages to one page
$mpdf = new mPDF();
$mpdf->SetImportUse();
$mpdf->SetDisplayMode('fullpage');
$mpdf->SetHeader('{DATE j-m-Y}|My Yearbook 2005|{PAGENO}');
$mpdf->SetFooter('|Printed using mPDF|');
$pagecount = $mpdf->SetSourceFile('test.pdf');
for ($i = 1; $i <= $pagecount; $i++) {
if ($i % 4 == 1) {
$mpdf->AddPage();
}
$pgheight = $mpdf->h - $mpdf->tMargin - $mpdf->bMargin;
$hspacing = min($spacing, $mpdf->pgwidth - $pw * 2);
$vspacing = min($spacing, $pgheight - $ph * 2);
$x1 = $mpdf->lMargin + ($mpdf->pgwidth / 2 - $hspacing / 2 - $pw) / 2;
$x2 = $mpdf->lMargin + $mpdf->pgwidth / 2 + $hspacing / 2 + ($mpdf->pgwidth / 2 - $hspacing / 2 - $pw) / 2;
$y1 = $mpdf->tMargin + ($pgheight / 2 - $vspacing / 2 - $ph) / 2;
$y2 = $mpdf->tMargin + $pgheight / 2 + $vspacing / 2 + ($pgheight / 2 - $vspacing / 2 - $ph) / 2;
if ($i % 4 == 1) {
$x = $x1;