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


PHP Html2Pdf::Output方法代码示例

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


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

示例1: dirname

<?php

/**
 * Html2Pdf Library - example
 *
 * HTML => PDF convertor
 * distributed under the LGPL License
 *
 * isset($_GET['vuehtml']) is not mandatory
 * it allow to display the result in the HTML format
 *
 * @package   Html2pdf
 * @author    Laurent MINGUET <webmaster@html2pdf.fr>
 * @copyright 2016 Laurent MINGUET
 */
require_once dirname(__FILE__) . '/../vendor/autoload.php';
use Spipu\Html2Pdf\Html2Pdf;
use Spipu\Html2Pdf\Html2PdfException;
// get the HTML
ob_start();
require dirname(__FILE__) . '/res/exemple01.php';
$content = ob_get_clean();
// convert to PDF
try {
    $html2pdf = new Html2Pdf('P', 'A4', 'fr');
    $html2pdf->writeHTML($content, isset($_GET['vuehtml']));
    $html2pdf->Output('exemple01.pdf');
} catch (Html2PdfException $e) {
    echo $e;
    exit;
}
开发者ID:bendspoons,项目名称:html2pdf,代码行数:31,代码来源:exemple01.php

示例2: testCase

 /**
  * test
  *
  * @return void
  * @expectedException \Spipu\Html2Pdf\Exception\HtmlParsingException
  */
 public function testCase()
 {
     $object = new Html2Pdf();
     $object->pdf->SetTitle('PhpUnit Test');
     $object->writeHTML('<g />');
     $object->Output('test.pdf', 'S');
 }
开发者ID:vienis,项目名称:html2pdf,代码行数:13,代码来源:GErrorTest.php

示例3: testCase

 /**
  * test: The image src is unknown
  *
  * @return void
  * @expectedException \Spipu\Html2Pdf\Exception\ImageException
  */
 public function testCase()
 {
     $object = new Html2Pdf();
     $object->pdf->SetTitle('PhpUnit Test');
     $object->writeHTML('<div style="background-image: url(' . dirname(__FILE__) . '/res/wrong.png)">Hello World</div>');
     $object->Output('test.pdf', 'S');
 }
开发者ID:vienis,项目名称:html2pdf,代码行数:13,代码来源:BackgroundErrorTest.php

示例4: testCase

 /**
  * test: The image src is unknown
  *
  * @return void
  * @expectedException \Spipu\Html2Pdf\Exception\ImageException
  */
 public function testCase()
 {
     $object = new Html2Pdf();
     $object->pdf->SetTitle('PhpUnit Test');
     $object->writeHTML('Hello World <img src="' . dirname(__FILE__) . '/res/wrong.png" />');
     $object->Output('test.pdf', 'S');
 }
开发者ID:vienis,项目名称:html2pdf,代码行数:13,代码来源:SrcErrorTest.php

示例5: testCase

 /**
  * test: the file extension must be PDF
  *
  * @return void
  * @expectedException \Spipu\Html2Pdf\Exception\Html2PdfException
  */
 public function testCase()
 {
     $object = new Html2Pdf();
     $object->pdf->SetTitle('PhpUnit Test');
     $object->writeHTML('<p>Hello World</p>');
     $object->Output('test.bad', 'S');
 }
开发者ID:juchi,项目名称:html2pdf,代码行数:13,代码来源:FileNameErrorTest.php

示例6: testInvalidCode

 /**
  * test: The HTML tag code provided is invalid
  *
  * @return void
  * @expectedException \Spipu\Html2Pdf\Exception\HtmlParsingException
  */
 public function testInvalidCode()
 {
     $object = new Html2Pdf();
     $object->pdf->SetTitle('PhpUnit Test');
     $object->writeHTML('<az1-r_h>Hello</az1-r_h>');
     $object->Output('test.pdf', 'S');
 }
开发者ID:juchi,项目名称:html2pdf,代码行数:13,代码来源:ParsingTest.php

示例7: testCase

 /**
  * test: the file extension must be PDF
  *
  * @return void
  */
 public function testCase()
 {
     $object = new Html2Pdf();
     $object->pdf->SetTitle('PhpUnit Test');
     $object->writeHTML('Hello World');
     $result = $object->Output('test.pdf', 'S');
     $this->assertContains('PhpUnit Test', $result);
 }
开发者ID:vienis,项目名称:html2pdf,代码行数:13,代码来源:FileNameOkTest.php

示例8: testCase

 /**
  * test: The image src is unknown
  *
  * @return void
  */
 public function testCase()
 {
     $object = new Html2Pdf();
     $object->pdf->SetTitle('PhpUnit Test');
     $object->writeHTML('Hello World <img src="' . dirname(__FILE__) . '/res/logo.png" />');
     $result = $object->Output('test.pdf', 'S');
     $this->assertContains('PhpUnit Test', $result);
 }
开发者ID:vienis,项目名称:html2pdf,代码行数:13,代码来源:SrcOkTest.php

示例9: testCase

 /**
  * test
  *
  * @return void
  * @expectedException \Spipu\Html2Pdf\Exception\TableException
  */
 public function testCase()
 {
     $sentence = 'Hello World ! ';
     $sentences = '';
     for ($k = 0; $k < 100; $k++) {
         $sentences .= $sentence;
     }
     $object = new Html2Pdf();
     $object->pdf->SetTitle('PhpUnit Test');
     $object->writeHTML('<table><tr><td style="width: 28mm">' . $sentences . '</td></tr></table>');
     $object->Output('test.pdf', 'S');
 }
开发者ID:vienis,项目名称:html2pdf,代码行数:18,代码来源:TdTooLongTest.php

示例10: testCase

    /**
     * test
     *
     * @return void
     * @expectedException \Spipu\Html2Pdf\Exception\HtmlParsingException
     */
    public function testCase()
    {
        $html = '
<page>
    <draw style="width:150mm; height:100mm;">
        <path style="fill:#770000; stroke:#AA0033;" d="n 20mm,40mm a16mm,8mm 0,0,0 16mm,8mm" />
    </draw>
</page>';
        $object = new Html2Pdf();
        $object->pdf->SetTitle('PhpUnit Test');
        $object->writeHTML($html);
        $object->Output('test.pdf', 'S');
    }
开发者ID:juchi,项目名称:html2pdf,代码行数:19,代码来源:PathInvalidTest.php

示例11: dirname

<?php

/**
 * Html2Pdf Library - example
 *
 * HTML => PDF convertor
 * distributed under the LGPL License
 *
 * isset($_GET['vuehtml']) is not mandatory
 * it allow to display the result in the HTML format
 *
 * @package   Html2pdf
 * @author    Laurent MINGUET <webmaster@html2pdf.fr>
 * @copyright 2016 Laurent MINGUET
 */
require_once dirname(__FILE__) . '/../vendor/autoload.php';
use Spipu\Html2Pdf\Html2Pdf;
use Spipu\Html2Pdf\Html2PdfException;
$html2pdf = new Html2Pdf('P', 'A4', 'fr');
// get the HTML
$content = file_get_contents(K_PATH_MAIN . 'examples/data/utf8test.txt');
$content = '<page style="font-family: freeserif"><br />' . nl2br($content) . '</page>';
// convert to PDF
try {
    $html2pdf->pdf->SetDisplayMode('real');
    $html2pdf->writeHTML($content, isset($_GET['vuehtml']));
    $html2pdf->Output('utf8.pdf');
} catch (Html2PdfException $e) {
    echo $e;
    exit;
}
开发者ID:bendspoons,项目名称:html2pdf,代码行数:31,代码来源:utf8.php

示例12: dirname

 *
 * isset($_GET['vuehtml']) is not mandatory
 * it allow to display the result in the HTML format
 *
 * @package   Html2pdf
 * @author    Laurent MINGUET <webmaster@html2pdf.fr>
 * @copyright 2016 Laurent MINGUET
 */
require_once dirname(__FILE__) . '/../vendor/autoload.php';
use Spipu\Html2Pdf\Html2Pdf;
use Spipu\Html2Pdf\Exception\Html2PdfException;
use Spipu\Html2Pdf\Exception\ExceptionFormatter;
// for display the post information
if (isset($_POST['test'])) {
    echo '<pre>';
    echo htmlentities(print_r($_POST, true));
    echo '</pre>';
    exit;
}
try {
    ob_start();
    require dirname(__FILE__) . '/res/forms.php';
    $content = ob_get_clean();
    $html2pdf = new Html2Pdf('P', 'A4', 'fr');
    $html2pdf->pdf->SetDisplayMode('fullpage');
    $html2pdf->writeHTML($content, isset($_GET['vuehtml']));
    $html2pdf->Output('forms.pdf');
} catch (Html2PdfException $e) {
    $formatter = new ExceptionFormatter($e);
    echo $formatter->getHtmlMessage();
}
开发者ID:vienis,项目名称:html2pdf,代码行数:31,代码来源:forms.php

示例13: dirname

<?php

/**
 * Html2Pdf Library - example
 *
 * HTML => PDF convertor
 * distributed under the LGPL License
 *
 * isset($_GET['vuehtml']) is not mandatory
 * it allow to display the result in the HTML format
 *
 * @package   Html2pdf
 * @author    Laurent MINGUET <webmaster@html2pdf.fr>
 * @copyright 2016 Laurent MINGUET
 */
require_once dirname(__FILE__) . '/../vendor/autoload.php';
use Spipu\Html2Pdf\Html2Pdf;
use Spipu\Html2Pdf\Exception\Html2PdfException;
use Spipu\Html2Pdf\Exception\ExceptionFormatter;
try {
    ob_start();
    include dirname(__FILE__) . '/res/svg.php';
    $content = ob_get_clean();
    $html2pdf = new Html2Pdf('P', 'A4', 'fr');
    $html2pdf->pdf->SetDisplayMode('fullpage');
    $html2pdf->writeHTML($content, isset($_GET['vuehtml']));
    $html2pdf->Output('svg.pdf');
} catch (Html2PdfException $e) {
    $formatter = new ExceptionFormatter($e);
    echo $formatter->getHtmlMessage();
}
开发者ID:vienis,项目名称:html2pdf,代码行数:31,代码来源:svg.php

示例14: dirname

<?php

/**
 * Html2Pdf Library - example
 *
 * HTML => PDF convertor
 * distributed under the LGPL License
 *
 * @package   Html2pdf
 * @author    Laurent MINGUET <webmaster@html2pdf.fr>
 * @copyright 2016 Laurent MINGUET
 *
 * isset($_GET['vuehtml']) is not mandatory
 * it allow to display the result in the HTML format
 */
use Spipu\Html2Pdf\Html2Pdf;
use Spipu\Html2Pdf\Html2PdfException;
// get the HTML
ob_start();
include dirname(__FILE__) . '/res/exemple12.php';
$content = ob_get_clean();
// convert to PDF
require_once dirname(__FILE__) . '/../vendor/autoload.php';
try {
    $html2pdf = new Html2Pdf('P', 'A4', 'fr');
    $html2pdf->writeHTML($content, isset($_GET['vuehtml']));
    $html2pdf->Output('exemple12.pdf');
} catch (Html2PdfException $e) {
    echo $e;
    exit;
}
开发者ID:RubenHarms,项目名称:html2pdf,代码行数:31,代码来源:exemple12.php

示例15: dirname

 *
 * @package   Html2pdf
 * @author    Laurent MINGUET <webmaster@html2pdf.fr>
 * @copyright 2016 Laurent MINGUET
 *
 * isset($_GET['vuehtml']) is not mandatory
 * it allow to display the result in the HTML format
 */
use Spipu\Html2Pdf\Html2Pdf;
use Spipu\Html2Pdf\Html2PdfException;
// get the HTML
ob_start();
?>
<page>
    <h1>Test de JavaScript 1</h1><br>
    <br>
    Normalement la fenetre d'impression devrait apparaitre automatiquement
</page>
<?php 
$content = ob_get_clean();
// convert to PDF
require_once dirname(__FILE__) . '/../vendor/autoload.php';
try {
    $html2pdf = new Html2Pdf('P', 'A4', 'fr');
    $html2pdf->pdf->IncludeJS("print(true);");
    $html2pdf->writeHTML($content, isset($_GET['vuehtml']));
    $html2pdf->Output('js1.pdf');
} catch (Html2PdfException $e) {
    echo $e;
    exit;
}
开发者ID:RubenHarms,项目名称:html2pdf,代码行数:31,代码来源:js1.php


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