本文整理汇总了PHP中mPDF::TOCpagebreakByArray方法的典型用法代码示例。如果您正苦于以下问题:PHP mPDF::TOCpagebreakByArray方法的具体用法?PHP mPDF::TOCpagebreakByArray怎么用?PHP mPDF::TOCpagebreakByArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mPDF
的用法示例。
在下文中一共展示了mPDF::TOCpagebreakByArray方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
<td style="border: 1px solid black;border-collapse: collapse; width:13%;"><center><b>Fecha</b></center></td>
</tr>
<tr>
<td style="border: 1px solid black;border-collapse: collapse;height: 60px; width:17%;" align="center">PRODEM Ltda.</td>
<td style="border: 1px solid black;border-collapse: collapse;height: 60px; width:35%;" align="center"></td>
<td style="border: 1px solid black;border-collapse: collapse;height: 60px; width:35%;" align="center"></td>
<td style="border: 1px solid black;border-collapse: collapse;height: 60px; width:13%;" align="center">'.date('d/m/Y').'</td>
</tr>
</table>
</div>';
$mpdf->TOCpagebreakByArray(array(
'TOCuseLinking' => true,
'toc_ohname' => 'indice',
'toc_ohvalue' => 1,
'toc_preHTML' => $previo,
'toc_postHTML' => $post,
'resetpagenum' => 2,
'ohname' => 'indice',
'ohvalue' => 1,
));
$valida = 0;
$mpdf->WriteHTML('<b><h2>1. Objetivo General</h2></b>');
$mpdf->TOC_Entry('<b style="font-family: roboto-light">1. Objetivo General</b>', 0);
if($row["objetivo"] == ''){
$mpdf->WriteHTML('<div style="text-align:justify;">No Aplica.</div>');
$altura = $mpdf->y;
if($altura > 205){
$mpdf->AddPage();
} else {
$mpdf->WriteHTML('<br>');
示例2: createPdf
/**
* Create a PDF and export to defined path
* @param $dir str directory of the source file to convert
* @param $src str filename of the source file to convert
* @param $path str path to export the resultant PDF to
* @param $chapters array chapters to convert into a single PDF
* @param $journalId int Id of the journal(imprint)
* @param $args array arguments for the conversion (e.g. Description, cover image, etc)
* @param $coverPath str path to export the front cover artwork to
*/
function createPdf($dir = null, $src, $path, $chapters = array(), $journalId, $args = array(), $coverPath)
{
$mpdf = new mPDF('utf-8');
$mpdf->useOddEven = 1;
$htmlEncode = array('title', 'author');
foreach ($htmlEncode as $encode) {
$args[$encode] = htmlentities($args[$encode], ENT_QUOTES, "UTF-8");
}
isset($args['title']) ? $mpdf->SetTitle($args['title']) : $mpdf->SetTitle("No Title");
isset($args['description']) ? $mpdf->SetSubject($args['description']) : $mpdf->SetSubject("No description");
isset($args['author']) ? $mpdf->SetCreator($args['author']) : $mpdf->SetCreator("No author");
$CBPPlatformDao =& DAORegistry::getDAO('CBPPlatformDAO');
$imprintType = $CBPPlatformDao->getImprintType($journalId);
$stylesheet = $CBPPlatformDao->getImprintStylesheet($journalId);
$stylesheetContents = file_get_contents($this->stylesheetDir . "{$stylesheet}.css");
$mpdf->WriteHTML($stylesheetContents, 1);
$mpdf->WriteHTML($this->contentStart . '
<htmlpagefooter name="myFooter1" style="display:none">
<table width="100%" style="vertical-align: bottom; font-family: serif; font-size: 8pt;
color: #000000; font-weight: bold; font-style: italic;"><tr>
<td width="33%" style="text-align: right; ">{PAGENO}</td>
</tr></table>
</htmlpagefooter>
<htmlpagefooter name="myFooter2" style="display:none">
<table width="100%" style="vertical-align: bottom; font-family: serif; font-size: 8pt;
color: #000000; font-weight: bold; font-style: italic;"><tr>
<td width="33%"><span style="font-weight: bold; font-style: italic;">{PAGENO}</span></td>
</tr></table>
</htmlpagefooter>');
$imagesize = getimagesize($args['cover']);
if (substr($imagesize[1] / $imagesize[0], 0, strpos($imagesize[1] / $imagesize[0], '.') + 1 + 2) == 1.41 || substr($imagesize[1] / $imagesize[0], 0, strpos($imagesize[1] / $imagesize[0], '.') + 1 + 2) == 1.53) {
$pdfContent .= '<div style="position: absolute; left:0; right: 0; top: 0; bottom: 0;"><img src="' . $args['cover'] . '" id="cover" /></div>';
} else {
$pdfContent .= "<div style='margin: 0 auto; width: 80%; text-align: center;'>";
if (isset($args['title'])) {
$pdfContent .= "<h1>" . $args['title'] . "</h1>";
}
if (isset($args['cover'])) {
$pdfContent .= "<img src=\"" . $args['cover'] . "\" >";
} else {
$pdfContent .= "<br/>";
}
if (isset($args['author'])) {
$pdfContent .= "<h2>" . $args['author'] . "</h2>";
}
$pdfContent .= "</div>";
}
$mpdf->WriteHTML($pdfContent);
$mpdf->AddPage('', '', '', '', 'Off');
$copyrightStatement = $CBPPlatformDao->getJournalCopyrightStatement($journalId);
if (!empty($copyrightStatement)) {
$copyrightStatement = reset($copyrightStatement);
$mpdf->AddPage('', '', '', '', 'Off');
$innerPageConent = "<div style='width: 90%; text-align: center; margin: 0 auto;'><p>" . $copyrightStatement . "</p></div>";
$mpdf->WriteHTML($innerPageConent);
}
if (!empty($chapters)) {
$mpdf->TOCpagebreakByArray(array('TOCusePaging' => true, 'TOCuseLinking' => true, 'toc_preHTML' => '<h1>Table of Contents</h1>', 'toc_postHTML' => '', 'resetpagenum' => 1, 'suppress' => 'true'));
$chapterCount = 0;
$authorBiographies = 0;
foreach ($chapters as $chapter) {
if (!isset($chapter['type']) && $chapter['type'] != "supp") {
$chapterCount++;
} else {
if ($chapter['desc'] == "Author Biography") {
$authorBiographies++;
}
$suppChapters = true;
}
}
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);
//.........这里部分代码省略.........
示例3: array
$h = array('odd' => array('R' => array('content' => 'Odd Header for ToC', 'font-size' => 8, 'font-style' => 'B', 'font-family' => 'DejaVuSansCondensed'), 'line' => 1), 'even' => array('L' => array('content' => 'Even Header for ToC', 'font-size' => 8, 'font-style' => 'B', 'font-family' => 'DejaVuSansCondensed'), 'line' => 1));
$f = array('odd' => array('L' => array('content' => '{DATE Y-m-d}', 'font-size' => 8, 'font-style' => 'BI', 'font-family' => 'DejaVuSansCondensed'), 'C' => array('content' => 'Odd Footer for ToC', 'font-size' => 8, 'font-style' => '', 'font-family' => ''), 'R' => array('content' => 'My Handbook', 'font-size' => 8, 'font-style' => 'BI', 'font-family' => 'DejaVuSansCondensed'), 'line' => 1), 'even' => array('L' => array('content' => 'My Handbook', 'font-size' => 8, 'font-style' => 'BI', 'font-family' => 'DejaVuSansCondensed'), 'C' => array('content' => 'Even Footer for ToC', 'font-size' => 8, 'font-style' => '', 'font-family' => ''), 'R' => array('content' => '{DATE Y-m-d}', 'font-size' => 8, 'font-style' => 'BI', 'font-family' => 'DejaVuSansCondensed'), 'line' => 0));
//==============================================================
include "../mpdf.php";
$mpdf = new mPDF('en-GB-x', 'A4', '', '', 32, 25, 27, 25, 16, 13);
$mpdf->mirrorMargins = 1;
$mpdf->SetDisplayMode('fullpage', 'two');
// LOAD a stylesheet
$stylesheet = file_get_contents('mpdfstyleA4.css');
$mpdf->WriteHTML($stylesheet, 1);
// The parameter 1 tells that this is css/style only and no body/html/text
$mpdf->WriteHTML('<h1>mPDF</h1><h2>Table of Contents & Bookmarks</h2>', 2);
// TOC TABLE OF CONTENTS and INDEX+++++++++++++++++++++++++++++++++++++++++++++
//$mpdf->WriteHTML('<pagebreak type="E" />');
//$mpdf->WriteHTML('<TOC font="" font-size="" indent="5" resetpagenum="1" pagenumstyle="A", suppress="off" />');
$mpdf->TOCpagebreakByArray(array('tocfont' => '', 'tocfontsize' => '', 'tocindent' => '5', 'TOCusePaging' => true, 'TOCuseLinking' => '', 'toc_orientation' => '', 'toc_mgl' => '45', 'toc_mgr' => '35', 'toc_mgt' => '', 'toc_mgb' => '', 'toc_mgh' => '', 'toc_mgf' => '', 'toc_ohname' => '', 'toc_ehname' => '', 'toc_ofname' => '', 'toc_efname' => '', 'toc_ohvalue' => 0, 'toc_ehvalue' => 0, 'toc_ofvalue' => -1, 'toc_efvalue' => -1, 'toc_preHTML' => '<h2>Contents</h2>', 'toc_postHTML' => '', 'toc_bookmarkText' => 'Content list', 'resetpagenum' => '1', 'pagenumstyle' => 'A', 'suppress' => 'off', 'orientation' => '', 'mgl' => '', 'mgr' => '', 'mgt' => '', 'mgb' => '', 'mgh' => '', 'mgf' => '', 'ohname' => '', 'ehname' => '', 'ofname' => '', 'efname' => '', 'ohvalue' => 0, 'ehvalue' => 0, 'ofvalue' => 0, 'efvalue' => 0, 'toc_id' => 0, 'pagesel' => '', 'toc_pagesel' => '', 'sheetsize' => '', 'toc_sheetsize' => ''));
$mpdf->setHTMLFooter('<div align="center"><b>{PAGENO} / {nbpg}</b></div>');
$mpdf->setHTMLFooter('<div align="center"><b><i>{PAGENO} / {nbpg}</i></b></div>', 'E');
//==============================================================
for ($j = 1; $j < 7; $j++) {
if ($j == 2) {
$mpdf->WriteHTML('<pagebreak resetpagenum="0" pagenumstyle="a" />', 2);
}
if ($j == 3) {
$mpdf->WriteHTML('<pagebreak resetpagenum="1" pagenumstyle="I" />', 2);
}
if ($j == 4) {
$mpdf->WriteHTML('<pagebreak resetpagenum="0" pagenumstyle="i" />', 2);
}
if ($j == 5) {
$mpdf->WriteHTML('<pagebreak resetpagenum="0" pagenumstyle="1" />', 2);