本文整理汇总了PHP中mPDF::writeHTML方法的典型用法代码示例。如果您正苦于以下问题:PHP mPDF::writeHTML方法的具体用法?PHP mPDF::writeHTML怎么用?PHP mPDF::writeHTML使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mPDF
的用法示例。
在下文中一共展示了mPDF::writeHTML方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: output
/**
* Generates Pdf from html
*
* @return string raw pdf data
*/
public function output()
{
//mPDF often produces a whole bunch of errors, although there is a pdf created when debug = 0
//Configure::write('debug', 0);
$MPDF = new \mPDF();
$MPDF->writeHTML($this->_Pdf->html());
return $MPDF->Output('', 'S');
}
示例2: output
/**
* Generates Pdf from html
*
* @return string raw pdf data
*/
public function output()
{
//mPDF often produces a whole bunch of errors, although there is a pdf created when debug = 0
//Configure::write('debug', 0);
$orientation = $this->_Pdf->orientation() == 'landscape' ? 'L' : 'P';
$MPDF = new \mPDF($this->_Pdf->encoding(), $this->_Pdf->pageSize() . '-' . $orientation);
$MPDF->writeHTML($this->_Pdf->html());
return $MPDF->Output('', 'S');
}
示例3: output
/**
* Generates Pdf from html
*
* @return string raw pdf data
*/
public function output()
{
//mPDF often produces a whole bunch of errors, although there is a pdf created when debug = 0
//Configure::write('debug', 0);
if ($this->_Pdf->orientation() == 'landscape') {
$this->_Pdf->pageSize($this->_Pdf->pageSize() . '-L');
}
$MPDF = new mPDF(Configure::read('App.encoding'), $this->_Pdf->pageSize());
$MPDF->writeHTML($this->_Pdf->html());
return $MPDF->Output('', 'S');
}
示例4: 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);
}
示例5: mPDF
}
$text .= $parts[1];
}
$converted = templateParser::parse_template($text, $object_arr);
$header = templateParser::parse_template($header, $object_arr);
$footer = templateParser::parse_template($footer, $object_arr);
$printable = str_replace("\n", "<br />", $converted);
if ($task == 'pdf' || $task == 'emailpdf') {
$file_name = $mod_strings['LBL_PDF_NAME'] . "_" . str_replace(" ", "_", $module->name) . ".pdf";
ob_clean();
try {
$pdf = new mPDF('en', 'A4', '', 'DejaVuSansCondensed', 15, 15, 16, 16, 8, 8);
$pdf->setAutoFont();
$pdf->SetHTMLHeader($header);
$pdf->SetHTMLFooter($footer);
$pdf->writeHTML($printable);
if ($task == 'pdf') {
$pdf->Output($file_name, "D");
} else {
$fp = fopen($sugar_config['upload_dir'] . 'attachfile.pdf', 'wb');
fclose($fp);
$pdf->Output($sugar_config['upload_dir'] . 'attachfile.pdf', 'F');
sendEmail::send_email($module, $module_type, '', $file_name, true);
}
} catch (mPDF_exception $e) {
echo $e;
}
} else {
if ($task == 'email') {
sendEmail::send_email($module, $module_type, $printable, '', false);
}
示例6: createPdf
//.........这里部分代码省略.........
}
for ($i = 0; $i < count($chapters); $i++) {
$htmlEncode = array('name', 'author');
foreach ($htmlEncode as $encode) {
$chapters[$i][$encode] = htmlentities($chapters[$i][$encode], ENT_QUOTES, "UTF-8");
}
$document = new TransformDoc();
$document->setStrFile($chapters[$i]['src'], $chapters[$i]['dir']);
$document->generateXHTML();
//problem, here
$document->validatorXHTML();
if ($chapterCount == 1) {
$contentPreg = $this->stripTagsAddChapters($document->getStrXHTML());
$contentPreg = ltrim($contentPreg);
if (substr($contentPreg, 0, 13) == "<pagebreak />") {
$contentPreg = substr_replace($contentPreg, '', 0, 13);
}
$mpdf->addPage('', '', '', '', 'On');
$mpdf->PageNumSubstitutions[] = array('from' => $mpdf->page + 1, 'reset' => 1, 'type' => '1', 'suppress' => 'off');
$mpdf->WriteHTML("<div class='content'>", 2);
$mpdf->WriteHTML($contentPreg, 2);
if ($suppChapters == true) {
foreach ($chapters as $chapter) {
if (isset($chapter['type']) && $chapter['type'] == "supp") {
$document = new TransformDoc();
$document->setStrFile($chapter['src'], $chapter['dir']);
$document->generateXHTML();
$document->validatorXHTML();
if ($authorBiographies > 1) {
$contentPreg = $this->stripTags($document->getStrXHTML());
$mpdf->TOC_Entry($chapter['name']);
$mpdf->WriteHTML("<pagebreak />" . $contentPreg, 2);
} else {
$addAuthorBiographyToBack = true;
$authorBiography = $this->stripTags($document->getStrXHTML());
}
}
}
}
break;
} else {
$contentPreg = $this->stripTags($document->getStrXHTML());
$contentPreg = ltrim($contentPreg);
if (substr($contentPreg, 0, 13) == "<pagebreak />") {
$contentPreg = substr_replace($contentPreg, '', 0, 13);
}
if ($i != 0) {
$prepend = "<pagebreak />";
} else {
$mpdf->addPage('', 'E', '', '', 'On');
$mpdf->PageNumSubstitutions[] = array('from' => $mpdf->page + 1, 'reset' => 1, 'type' => '1', 'suppress' => 'off');
$mpdf->WriteHTML("<div class='content'>", 2);
}
if ($imprintType == "atomistic") {
$mpdf->WriteHTML($prepend . "<tocentry content='" . $chapters[$i]['name'] . "' level='0' />" . $contentPreg, 2);
} elseif ($imprintType == "collection") {
if ($chapters[$i]['description'] != "") {
$introduction = "<div class='submissionIntro'><h1>" . $chapters[$i]['author'] . "</h1>" . $this->stripTags($chapters[$i]['description'], true) . "</div><pagebreak /><tocentry content='" . $chapters[$i]['name'] . " by " . $chapters[$i]['author'] . "' level='0' />";
}
$mpdf->WriteHTML($prepend . $introduction . $contentPreg, 2);
}
}
}
$mpdf->writeHTML("</div>");
if (isset($args['description'])) {
$mpdf->WriteHTML("<pagebreak page-selector='none' odd-footer-value = '' even-footer-value= '' /><pagebreak /><div style='width: 90%; text-align: center; margin: 0 auto;'><p>" . $this->stripTags($args['description'], true) . "</p></div>", 2);
if ($addAuthorBiographyToBack == true) {
$backCoverContent .= "<div style='width: 90%; text-align: center; margin: 0 auto; margin-top: 10px;'><p>" . $authorBiography . "</p></div>";
}
$backCoverContent .= "<p style='width: 90%; text-align: center; margin: 0 auto;'><strong>Published " . date("F Y") . ", Scarborough, UK</strong></p>";
$mpdf->WriteHTML($backCoverContent, 2);
}
$mpdf->WriteHTML("</body></html>");
$pdfData = $mpdf->Output('', 'S');
$pageCount = $mpdf->page;
file_put_contents($path, $pdfData);
if (file_exists($this->stylesheetDir . "{$stylesheet}-FC.css")) {
$this->createCoverPdf($stylesheet, $pageCount, $args['cover'], $this->stripTags($args['description'], true), $addAuthorBiographyToBack, $authorBiography, $args['title'], $args['imprint'], $coverPath);
}
return true;
} else {
$document = new TransformDoc();
$document->setStrFile($src, $dir);
$document->generateXHTML();
$document->validatorXHTML();
$contentPreg = $this->stripTagsAddChapters($document->getStrXHTML());
$contentPreg = ltrim($contentPreg);
if (substr($contentPreg, 0, 13) == "<pagebreak />") {
$contentPreg = substr_replace($contentPreg, '', 0, 13);
}
$mpdf->addPage('', 'E', '', '', 'On');
$mpdf->PageNumSubstitutions[] = array('from' => $mpdf->page + 1, 'reset' => 1, 'type' => '1', 'suppress' => 'off');
$mpdf->WriteHTML("<div class='content'>", 2);
$mpdf->WriteHTML($contentPreg, 2);
$mpdf->WriteHTML("</div></body></html>");
$pdfData = $mpdf->Output('', 'S');
file_put_contents($path, $pdfData);
return true;
}
}
示例7: fopen
$note->modified_user_id = $current_user->id;
$note->created_by = $current_user->id;
$note->name = $file_name;
$note->parent_type = $module_type;
$note->parent_id = $module->id;
$note->file_mime_type = 'application/pdf';
$note->filename = $file_name;
if ($module_type == 'Contacts') {
$note->contact_id = $module->id;
$note->parent_type = 'Accounts';
$note->parent_id = $module->account_id;
}
$note->save();
$fp = fopen('cache/upload/nfile.pdf', 'wb');
fclose($fp);
$pdf_history->setAutoFont();
$pdf_history->SetHTMLHeader($header);
$pdf_history->SetHTMLFooter($footer);
$pdf_history->writeHTML($printable);
$pdf_history->Output('cache/upload/nfile.pdf', 'F');
$pdf->AddPage();
$pdf->setAutoFont();
$pdf->SetHTMLHeader($header);
$pdf->SetHTMLFooter($footer);
$pdf->writeHTML($printable);
rename('cache/upload/nfile.pdf', 'cache/upload/' . $note->id);
} catch (mPDF_exception $e) {
echo $e;
}
}
$pdf->Output($file_name, "D");
示例8: createPDF
public function createPDF($id)
{
$model = $this->loadModel($id);
$stylesheet = file_get_contents('C:\\xampp\\htdocs\\Gineobs\\themes\\hebo\\css\\pdfMain.css');
$texto = '<div id=contenedor>';
$texto = $texto . '<div id=columna1>';
$texto = $texto . '<H1 class="h1PDF"> Dra. Maria C. Hernandez N.</H1>';
$texto = $texto . '<H1 class="h1PDF"> Ginecologo-Obstetra.</H1>';
$texto = $texto . '<H1 class="h1PDF"> C.C. Galeno Center Of. C8 Av. Country Club. Bna.</H1>';
$texto = $texto . '<H1 class="h1PDF"> Telf. 0281-2743367/0414-8240064. CM972.</H1>';
$texto = $texto . '<H1 class="h1PDF"> Rif: 3956719-5 MSAS 18083.</H1>';
$texto = $texto . '</div>';
$texto = $texto . '<div id=columna2>';
$texto = $texto . '<H1 class="h1PDF"> Dra. Maria C. Hernandez N.</H1>';
$texto = $texto . '<H1 class="h1PDF"> Ginecologo-Obstetra.</H1>';
$texto = $texto . '<H1 class="h1PDF"> C.C. Galeno Center Of. C8 Av. Country Club. Bna.</H1>';
$texto = $texto . '<H1 class="h1PDF"> Telf. 0281-2743367/0414-8240064. CM972.</H1>';
$texto = $texto . '<H1 class="h1PDF"> Rif: 3956719-5 MSAS 18083.</H1>';
$texto = $texto . '</div>';
$texto = $texto . '<div id=columna1>';
$texto = $texto . '<p>Medicina: ' . $this->visualizarArreglo($model->recipeMedicinas, 'nombre') . '</p>';
$texto = $texto . '<p>Indicaciones: ' . $model->indicaciones . ' </p>';
$texto = $texto . '<p>Paciente: ' . Paciente::GET_NOMBRE_COMPLETO_PK($model->paciente_id) . ' </p>';
$texto = $texto . '<p>Fecha de creacion: ' . $model->fecha . ' </p>';
$texto = $texto . '</div>';
$texto = $texto . '</div>';
/* $mpdf->writeHTML(
$this->render('create',null ,true)
);*/
//Propiedades del header y footer
// $mpdf->defaultheaderfontsize=10;
// $mpdf->defaultheaderfontstyle='B';
// $mpdf->defaultheaderline=0;
// $mpdf->defaultfooterfontsize=10;
// $mpdf->defaultfooterfontstyle='BI';
// $mpdf->defaultfooterline=0;
//configurando pdf general
$mpdf = new mPDF('utf-8', 'Letter-L');
//agregando header y footer
$mpdf->SetHeader('{DATE j-m-Y}||Recipe #' . $model->id);
$mpdf->SetFooter('Dr. María Hernández|Ginecologia y obstetricia|{PAGENO}');
//Propiedades del PDF
$mpdf->setTitle("Recipe Medico");
$mpdf->setAuthor("María Hernández");
$mpdf->setCreator("Edgar Cardona y Gabriela Soto");
$mpdf->setSubject("Recipe medico para tratamiento de pacientes.");
$mpdf->setKeywords("Recipe,Medico");
//escribiendo CSS
$mpdf->WriteHTML($stylesheet, 1);
//Escribiendo PDF
$mpdf->writeHTML($texto, 2);
//Salida
$mpdf->output("Recipe Medico", EYiiPdf::OUTPUT_TO_BROWSER);
}