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


PHP TCPDF::Bookmark方法代码示例

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


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

示例1: testPdfOutput

    public function testPdfOutput()
    {
        // create new PDF document
        $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
        // set document information
        $pdf->SetCreator(PDF_CREATOR);
        $pdf->SetAuthor('Nicola Asuni');
        $pdf->SetTitle('TCPDF Example 015');
        $pdf->SetSubject('TCPDF Tutorial');
        $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
        // set default header data
        $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE . ' 015', PDF_HEADER_STRING);
        // set header and footer fonts
        $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
        $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
        // set default monospaced font
        $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
        // set margins
        $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
        $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
        $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
        // set auto page breaks
        $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
        // set image scale factor
        $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
        // set some language-dependent strings (optional)
        $pdf->setLanguageArray($this->langSettings);
        // ---------------------------------------------------------
        // Bookmark($txt, $level=0, $y=-1, $page='', $style='', $color=array(0,0,0))
        // set font
        $pdf->SetFont('times', 'B', 20);
        // add a page
        $pdf->AddPage();
        // set a bookmark for the current position
        $pdf->Bookmark('Chapter 1', 0, 0, '', 'B', array(0, 64, 128));
        // print a line using Cell()
        $pdf->Cell(0, 10, 'Chapter 1', 0, 1, 'L');
        $pdf->SetFont('times', 'I', 14);
        $pdf->Write(0, 'You can set PDF Bookmarks using the Bookmark() method.
You can set PDF Named Destinations using the setDestination() method.');
        $pdf->SetFont('times', 'B', 20);
        // add other pages and bookmarks
        $pdf->AddPage();
        $pdf->Bookmark('Paragraph 1.1', 1, 0, '', '', array(0, 0, 0));
        $pdf->Cell(0, 10, 'Paragraph 1.1', 0, 1, 'L');
        $pdf->AddPage();
        $pdf->Bookmark('Paragraph 1.2', 1, 0, '', '', array(0, 0, 0));
        $pdf->Cell(0, 10, 'Paragraph 1.2', 0, 1, 'L');
        $pdf->AddPage();
        $pdf->Bookmark('Sub-Paragraph 1.2.1', 2, 0, '', 'I', array(0, 0, 0));
        $pdf->Cell(0, 10, 'Sub-Paragraph 1.2.1', 0, 1, 'L');
        $pdf->AddPage();
        $pdf->Bookmark('Paragraph 1.3', 1, 0, '', '', array(0, 0, 0));
        $pdf->Cell(0, 10, 'Paragraph 1.3', 0, 1, 'L');
        $pdf->AddPage();
        // add a named destination so you can open this document at this page using the link: "example_015.pdf#chapter2"
        $pdf->setDestination('chapter2', 0, '');
        // add a bookmark that points to a named destination
        $pdf->Bookmark('Chapter 2', 0, 0, '', 'BI', array(128, 0, 0), -1, '#chapter2');
        $pdf->Cell(0, 10, 'Chapter 2', 0, 1, 'L');
        $pdf->SetFont('times', 'I', 14);
        $pdf->Write(0, 'Once saved, you can open this document at this page using the link: "example_015.pdf#chapter2".');
        $pdf->AddPage();
        $pdf->setDestination('chapter3', 0, '');
        $pdf->SetFont('times', 'B', 20);
        $pdf->Bookmark('Chapter 3', 0, 0, '', 'B', array(0, 64, 128));
        $pdf->Cell(0, 10, 'Chapter 3', 0, 1, 'L');
        $pdf->AddPage();
        $pdf->setDestination('chapter4', 0, '');
        $pdf->SetFont('times', 'B', 20);
        $pdf->Bookmark('Chapter 4', 0, 0, '', 'B', array(0, 64, 128));
        $pdf->Cell(0, 10, 'Chapter 4', 0, 1, 'L');
        $pdf->AddPage();
        $pdf->Bookmark('Chapter 5', 0, 0, '', 'B', array(0, 128, 0));
        $pdf->Cell(0, 10, 'Chapter 5', 0, 1, 'L');
        $txt = 'Example of File Attachment.
Double click on the icon to open the attached file.';
        $pdf->SetFont('helvetica', '', 10);
        $pdf->Write(0, $txt, '', 0, 'L', true, 0, false, false, 0);
        // attach an external file TXT file
        $pdf->Annotation(20, 50, 5, 5, 'TXT file', array('Subtype' => 'FileAttachment', 'Name' => 'PushPin', 'FS' => 'tests/data/utf8test.txt'));
        // attach an external file
        $pdf->Annotation(50, 50, 5, 5, 'PDF file', array('Subtype' => 'FileAttachment', 'Name' => 'PushPin', 'FS' => 'tests/_expected_pdfs/example_012.pdf'));
        // add a bookmark that points to an embedded file
        // NOTE: prefix the file name with the * character for generic file and with % character for PDF file
        $pdf->Bookmark('TXT file', 0, 0, '', 'B', array(128, 0, 255), -1, '*utf8test.txt');
        // add a bookmark that points to an embedded file
        // NOTE: prefix the file name with the * character for generic file and with % character for PDF file
        $pdf->Bookmark('PDF file', 0, 0, '', 'B', array(128, 0, 255), -1, '%tests/_expected_pdfs/example_012.pdf');
        // add a bookmark that points to an external URL
        $pdf->Bookmark('External URL', 0, 0, '', 'B', array(0, 0, 255), -1, 'http://www.tcpdf.org');
        $this->comparePdfs($pdf);
    }
开发者ID:fooman,项目名称:tcpdf,代码行数:93,代码来源:Example015Test.php

示例2:

$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
//set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings
$pdf->setLanguageArray($l);
// ---------------------------------------------------------
// set font
$pdf->SetFont('times', 'B', 20);
// add a page
$pdf->AddPage();
// set a bookmark for the current position
$pdf->Bookmark('Chapter 1', 0, 0);
// print a line using Cell()
$pdf->Cell(0, 10, 'Chapter 1', 0, 1, 'L');
$pdf->AddPage();
$pdf->Bookmark('Paragraph 1.1', 1, 0);
$pdf->Cell(0, 10, 'Paragraph 1.1', 0, 1, 'L');
$pdf->AddPage();
$pdf->Bookmark('Paragraph 1.2', 1, 0);
$pdf->Cell(0, 10, 'Paragraph 1.2', 0, 1, 'L');
$pdf->AddPage();
$pdf->Bookmark('Sub-Paragraph 1.2.1', 2, 0);
$pdf->Cell(0, 10, 'Sub-Paragraph 1.2.1', 0, 1, 'L');
$pdf->AddPage();
$pdf->Bookmark('Paragraph 1.3', 1, 0);
$pdf->Cell(0, 10, 'Paragraph 1.3', 0, 1, 'L');
$pdf->AddPage();
开发者ID:JVS-IS,项目名称:ICONITO-EcoleNumerique,代码行数:31,代码来源:example_015.php

示例3: array

$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
//set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings
$pdf->setLanguageArray($l);
// ---------------------------------------------------------
// Bookmark($txt, $level=0, $y=-1, $page='', $style='', $color=array(0,0,0))
// set font
$pdf->SetFont('times', 'B', 20);
// add a page
$pdf->AddPage();
// set a bookmark for the current position
$pdf->Bookmark('Chapter 1', 0, 0, '', 'B', array(0, 64, 128));
// print a line using Cell()
$pdf->Cell(0, 10, 'Chapter 1', 0, 1, 'L');
$pdf->SetFont('times', 'I', 14);
$pdf->Write(0, 'You can set PDF Bookmarks using the Bookmark() method.
You can set PDF Named Destinations using the setDestination() method.');
$pdf->SetFont('times', 'B', 20);
// add other pages and bookmarks
$pdf->AddPage();
$pdf->Bookmark('Paragraph 1.1', 1, 0, '', '', array(0, 0, 0));
$pdf->Cell(0, 10, 'Paragraph 1.1', 0, 1, 'L');
$pdf->AddPage();
$pdf->Bookmark('Paragraph 1.2', 1, 0, '', '', array(0, 0, 0));
$pdf->Cell(0, 10, 'Paragraph 1.2', 0, 1, 'L');
$pdf->AddPage();
$pdf->Bookmark('Sub-Paragraph 1.2.1', 2, 0, '', 'I', array(0, 0, 0));
开发者ID:adisonc,项目名称:MaineLearning,代码行数:31,代码来源:example_015.php

示例4: isset

 $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
 $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
 $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
 $pdf->setFontSubsetting(false);
 $pdf->SetFont('helvetica', '', 12);
 $filename = $uniqid . "_" . $story["title"] . " - " . $story["author"] . ".pdf";
 $pdf->AddPage();
 $cover = $content_start . "<div class='coverPage'><h1>{$story["title"]}</h1>\n<h2>by: {$story["author"]}</h2></div>" . $bookEnd;
 $pdf->writeHTMLCell(0, 0, '', '', $cover, 0, 1, 0, true, 'C', true);
 for ($i = 0; $i < $numChapter; $i++) {
     $title = isset($story["chapters"]["title"][$i]) ? $story["chapters"]["title"][$i] : "";
     $content = isset($story["chapters"]["content"][$i]) ? $story["chapters"]["content"][$i] : "";
     if (!empty($content) && !empty($title)) {
         $title = formatTitle($title, $i);
         $pdf->AddPage();
         $pdf->Bookmark($title, 0, 0, '', 'B', array(0, 0, 0));
         $pdf->writeHTMLCell(0, 0, '', '', "<h2>{$title}</h2>", 0, 1, 0, true, 'C', true);
         $html = $content_start . $content . $bookEnd;
         $pdf->writeHTML($html, true, false, true, false, '');
     }
 }
 $pdf->addTOCPage();
 $pdf->SetFont('helvetica', 'B', 16);
 $pdf->MultiCell(0, 0, 'Table Of Contents', 0, 'C', 0, 1, '', '', true, 0);
 $pdf->Ln();
 $pdf->SetFont('helvetica', '', 12);
 $pdf->addTOC(2, 'helvetica', '.', 'TOC', 'B', array(0, 0, 0));
 $pdf->endTOCPage();
 $pdf->Output("./tmp/" . $filename, 'F');
 if (!empty($email)) {
     mailAttachment($filename, "./tmp/", $email, $uniqid);
开发者ID:NakedFury,项目名称:FicSave,代码行数:31,代码来源:exec.php

示例5: emarking_create_response_pdf

/**
 * Creates the PDF version (downloadable) of the whole feedback produced by the teacher/tutor
 *
 * @param unknown $draft            
 * @param unknown $student            
 * @param unknown $context            
 * @param unknown $cmid            
 * @return boolean
 */
function emarking_create_response_pdf($draft, $student, $context, $cmid)
{
    global $CFG, $DB;
    require_once $CFG->libdir . '/pdflib.php';
    $fs = get_file_storage();
    if (!($submission = $DB->get_record('emarking_submission', array('id' => $draft->submissionid)))) {
        return false;
    }
    if (!($pages = $DB->get_records('emarking_page', array('submission' => $submission->id), 'page ASC'))) {
        return false;
    }
    if (!($emarking = $DB->get_record('emarking', array('id' => $submission->emarking)))) {
        return false;
    }
    $numpages = count($pages);
    $sqlcomments = "SELECT ec.id,\n\t\t\tec.posx,\n\t\t\tec.posy,\n\t\t\tec.rawtext,\n\t\t\tec.pageno,\n\t\t\tgrm.maxscore,\n\t\t\tec.levelid,\n\t\t\tec.width,\n\t\t\tec.colour,\n\t\t\tec.textformat,\n\t\t\tgrl.score AS score,\n\t\t\tgrl.definition AS leveldesc,\n\t\t\tgrc.id AS criterionid,\n\t\t\tgrc.description AS criteriondesc,\n\t\t\tu.id AS markerid, CONCAT(u.firstname,' ',u.lastname) AS markername\n\t\t\tFROM {emarking_comment} ec\n\t\t\tINNER JOIN {emarking_page} ep ON (ec.draft = :draft AND ec.page = ep.id)\n\t\t\tLEFT JOIN {user} u ON (ec.markerid = u.id)\n\t\t\tLEFT JOIN {gradingform_rubric_levels} grl ON (ec.levelid = grl.id)\n\t\t\tLEFT JOIN {gradingform_rubric_criteria} grc ON (grl.criterionid = grc.id)\n\t\t\tLEFT JOIN (\n\t\t\tSELECT grl.criterionid, max(score) AS maxscore\n\t\t\tFROM {gradingform_rubric_levels} grl\n\t\t\tGROUP BY grl.criterionid\n\t\t\t) AS grm ON (grc.id = grm.criterionid)\n\t\t\tWHERE ec.pageno > 0\n\t\t\tORDER BY ec.pageno";
    $params = array('draft' => $draft->id);
    $comments = $DB->get_records_sql($sqlcomments, $params);
    $commentsperpage = array();
    foreach ($comments as $comment) {
        if (!isset($commentsperpage[$comment->pageno])) {
            $commentsperpage[$comment->pageno] = array();
        }
        $commentsperpage[$comment->pageno][] = $comment;
    }
    // Parameters for PDF generation.
    $iconsize = 5;
    $tempdir = emarking_get_temp_dir_path($emarking->id);
    if (!file_exists($tempdir)) {
        emarking_initialize_directory($tempdir, true);
    }
    // Create new PDF document.
    $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
    // Set document information.
    $pdf->SetCreator(PDF_CREATOR);
    $pdf->SetAuthor($student->firstname . ' ' . $student->lastname);
    $pdf->SetTitle($emarking->name);
    $pdf->SetSubject('Exam feedback');
    $pdf->SetKeywords('feedback, emarking');
    $pdf->SetPrintHeader(false);
    $pdf->SetPrintFooter(false);
    // Set default header data.
    $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE . ' 036', PDF_HEADER_STRING);
    // Set header and footer fonts.
    $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
    $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
    // Set default monospaced font.
    $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
    // Set margins.
    $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
    $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
    $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
    // Set auto page breaks.
    $pdf->SetAutoPageBreak(true, PDF_MARGIN_BOTTOM);
    // Set image scale factor.
    $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
    // Set some language-dependent strings (optional).
    if (@file_exists(dirname(__FILE__) . '/lang/eng.php')) {
        require_once dirname(__FILE__) . '/lang/eng.php';
        $pdf->setLanguageArray($l);
    }
    // Set font.
    $pdf->SetFont('times', '', 16);
    foreach ($pages as $page) {
        // Add a page.
        $pdf->AddPage();
        // Get the current page break margin.
        $bmargin = $pdf->getBreakMargin();
        // Get current auto-page-break mode.
        $autopagebreak = $pdf->getAutoPageBreak();
        // Disable auto-page-break.
        $pdf->SetAutoPageBreak(false, 0);
        // Set bacground image.
        $pngfile = $fs->get_file_by_id($page->file);
        $imgfile = emarking_get_path_from_hash($tempdir, $pngfile->get_pathnamehash());
        $pdf->Image($imgfile, 0, 0, 210, 297, '', '', '', false, 300, '', false, false, 0);
        // Restore auto-page-break status.
        // Set the starting point for the page content.
        $pdf->setPageMark();
        $dimensions = $pdf->getPageDimensions();
        if (isset($commentsperpage[$page->page])) {
            foreach ($commentsperpage[$page->page] as $comment) {
                $content = $comment->rawtext;
                $posx = (int) ((double) $comment->posx * 210);
                $posy = (int) ((double) $comment->posy * 297);
                if ($comment->textformat == 1) {
                    // Text annotation.
                    $pdf->Annotation($posx, $posy, 6, 6, $content, array('Subtype' => 'Text', 'StateModel' => 'Review', 'State' => 'None', 'Name' => 'Comment', 'NM' => 'Comment' . $comment->id, 'T' => $comment->markername, 'Subj' => 'example', 'C' => array(0, 0, 255)));
                    $pdf->Bookmark(get_string('comment', 'mod_emarking') . ' ' . $comment->id, 0, $posy);
                } else {
                    if ($comment->textformat == 2) {
//.........这里部分代码省略.........
开发者ID:hansnok,项目名称:emarking,代码行数:101,代码来源:locallib.php

示例6: time

//set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
//set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set image scale factor
$pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
$pdf->setLanguageArray($l);
//set language items
//initialize document
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->Bookmark('Variuos Tests', 0, 0);
// set barcode
$pdf->SetBarcode(date("Y-m-d H:i:s", time()));
$pdf->Bookmark('Bidirectional string', 1, -1);
$pdf->SetFont("FreeSerif", "", 12);
$pdf->writeHTML("The words &#8220;<span dir=\"rtl\">&#1502;&#1494;&#1500; [mazel] &#1496;&#1493;&#1489; [tov]</span>&#8221; mean &#8220;Congratulations!&#8221;", true, 0);
// Image example
$pdf->Image("images/logo_example.gif", 100, 100, 20, 20, '', 'http://www.tecnick.com', '');
// output some HTML code
$pdf->Bookmark('HTML code', 1, -1);
$pdf->writeHTML($htmlcontent, true, 0);
// output two html columns
$first_column_width = 80;
$current_y_position = $pdf->getY();
$pdf->writeHTMLCell($first_column_width, 0, 0, $current_y_position, "<b>hello</b>", 0, 0, 0);
$pdf->writeHTMLCell(0, 0, $first_column_width, $current_y_position, "<i>world</i>", 0, 1, 0);
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:31,代码来源:test_unicode.php

示例7: pdf_eight

/**
 * 生成目录
 * @author zhaoning <zhaoning@leju.com>
 */
function pdf_eight()
{
    // Include the main TCPDF library (search for installation path).
    require_once 'tcpdf.php';
    // create new PDF document
    $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
    // set document information
    $pdf->SetCreator(PDF_CREATOR);
    $pdf->SetAuthor('Nicola Asuni');
    $pdf->SetTitle('TCPDF Example 045');
    $pdf->SetSubject('TCPDF Tutorial');
    $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
    // set default header data
    $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE . ' 045', PDF_HEADER_STRING);
    // set header and footer fonts
    $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
    $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
    // set default monospaced font
    $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
    // set margins
    $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
    $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
    $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
    // set auto page breaks
    $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
    // set image scale factor
    $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
    // set some language-dependent strings (optional)
    if (@file_exists(dirname(__FILE__) . '/lang/eng.php')) {
        require_once dirname(__FILE__) . '/lang/eng.php';
        $pdf->setLanguageArray($l);
    }
    // ---------------------------------------------------------
    // set font
    $pdf->SetFont('times', 'B', 20);
    // add a page
    $pdf->AddPage();
    // set a bookmark for the current position
    $pdf->Bookmark('Chapter 1', 0, 0, '', 'B', array(0, 64, 128));
    // print a line using Cell()
    $pdf->Cell(0, 10, 'Chapter 1', 0, 1, 'L');
    // Create a fixed link to the first page using the * character
    $index_link = $pdf->AddLink();
    $pdf->SetLink($index_link, 0, '*1');
    $pdf->Cell(0, 10, 'Link to INDEX', 0, 1, 'R', false, $index_link);
    $pdf->AddPage();
    $pdf->Bookmark('Paragraph 1.1', 1, 0, '', '', array(128, 0, 0));
    $pdf->Cell(0, 10, 'Paragraph 1.1', 0, 1, 'L');
    $pdf->AddPage();
    $pdf->Bookmark('Paragraph 1.2', 1, 0, '', '', array(128, 0, 0));
    $pdf->Cell(0, 10, 'Paragraph 1.2', 0, 1, 'L');
    $pdf->AddPage();
    $pdf->Bookmark('Sub-Paragraph 1.2.1', 2, 0, '', 'I', array(0, 128, 0));
    $pdf->Cell(0, 10, 'Sub-Paragraph 1.2.1', 0, 1, 'L');
    $pdf->AddPage();
    $pdf->Bookmark('Paragraph 1.3', 1, 0, '', '', array(128, 0, 0));
    $pdf->Cell(0, 10, 'Paragraph 1.3', 0, 1, 'L');
    // fixed link to the first page using the * character
    $html = '<a href="#*1" style="color:blue;">link to INDEX (page 1)</a>';
    $pdf->writeHTML($html, true, false, true, false, '');
    // add some pages and bookmarks
    for ($i = 2; $i < 12; $i++) {
        $pdf->AddPage();
        $pdf->Bookmark('Chapter ' . $i, 0, 0, '', 'B', array(0, 64, 128));
        $pdf->Cell(0, 10, 'Chapter ' . $i, 0, 1, 'L');
    }
    // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
    // add a new page for TOC
    $pdf->addTOCPage();
    // write the TOC title
    $pdf->SetFont('times', 'B', 16);
    $pdf->MultiCell(0, 0, 'Table Of Content', 0, 'C', 0, 1, '', '', true, 0);
    $pdf->Ln();
    $pdf->SetFont('dejavusans', '', 12);
    // add a simple Table Of Content at first page
    // (check the example n. 59 for the HTML version)
    $pdf->addTOC(1, 'courier', '.', 'INDEX', 'B', array(128, 0, 0));
    // end of TOC page
    $pdf->endTOCPage();
    // ---------------------------------------------------------
    //Close and output PDF document
    $pdf->Output('example.pdf', 'I');
}
开发者ID:zncode,项目名称:codebase,代码行数:87,代码来源:index.php

示例8: wpautop

            //$content = preg_replace('/< *\/ *blockquote *>/', 'AAAAAAAAAAAAAA-------', $content);//now replace the closing tag
          }*/
        if ($objPost->post_type == "page") {
            //insert appropriate html before and after every page and post
            $content = $oOptions->beforePage . $content . $oOptions->afterPage;
        } else {
            $content = $oOptions->beforePost . $content . $oOptions->afterPost;
        }
        $content = kalins_pdf_page_shortcode_replace($content, $objPost);
        if ($oOptions->autoPageBreak) {
            // add a page
            $objTcpdf->AddPage();
        }
        if ($includeTOC) {
            //if we're including a TOC, add the bookmark. Pretty sweet that this still works if we're not adding new pages for each post
            $objTcpdf->Bookmark($objPost->post_title, 0, 0);
        }
        $strHtml = wpautop($content, true);
        $totalHTML = $totalHTML . $strHtml;
        $totalTXT = $totalTXT . $content;
        // output the HTML content
        $objTcpdf->writeHTML($strHtml, true, 0, true, 0);
        //$proBar->increase();
    }
} catch (Exception $e) {
    $outputVar->status = "problem creating pages and posts. Perhaps there's a problem with one of the pages you've selected or with the before or after HTML.";
    die(json_encode($outputVar));
}
try {
    if ($finalPage != "") {
        $objTcpdf->AddPage();
开发者ID:Rhytz,项目名称:kalins-pdf-creation-station,代码行数:31,代码来源:kalins_pdf_create.php


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