本文整理汇总了PHP中HTML2PDF::SetModulePath方法的典型用法代码示例。如果您正苦于以下问题:PHP HTML2PDF::SetModulePath方法的具体用法?PHP HTML2PDF::SetModulePath怎么用?PHP HTML2PDF::SetModulePath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTML2PDF
的用法示例。
在下文中一共展示了HTML2PDF::SetModulePath方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PDFDoc
// - Optionally add table of contents, including setting the depth and appearance.
//---------------------------------------------------------------------------------------
$output_path = "../../TestFiles/Output/html2pdf_example";
$host = "http://www.gutenberg.org/";
$page0 = "wiki/Main_Page";
$page1 = "catalog/";
$page2 = "browse/recent/last1";
$page3 = "wiki/Gutenberg:The_Sheet_Music_Project";
// The first step in every application using PDFNet is to initialize the
// library and set the path to common PDF resources. The library is usually
// initialized only once, but calling Initialize() multiple times is also fine.
PDFNet::Initialize();
// For HTML2PDF we need to locate the html2pdf module. If placed with the
// PDFNet library, or in the current working directory, it will be loaded
// automatically. Otherwise, it must be set manually using HTML2PDF.SetModulePath.
HTML2PDF::SetModulePath("./../../../PDFNetC/Lib");
//--------------------------------------------------------------------------------
// Example 1) Simple conversion of a web page to a PDF doc.
$doc = new PDFDoc();
// now convert a web page, sending generated PDF pages to doc
$converter = new HTML2PDF();
$converter->InsertFromURL($host . $page0);
if ($converter->Convert($doc)) {
$doc->Save($output_path . "_01.pdf", SDFDoc::e_linearized);
} else {
echo printf("Conversion failed. HTTP Code: %d\n%s", $converter->GetHTTPErrorCode(), $converter->GetLog());
}
$doc->Close();
//--------------------------------------------------------------------------------
// Example 2) Modify the settings of the generated PDF pages and attach to an
// existing PDF document.