本文整理汇总了PHP中HTML2FPDF::WriteHTML方法的典型用法代码示例。如果您正苦于以下问题:PHP HTML2FPDF::WriteHTML方法的具体用法?PHP HTML2FPDF::WriteHTML怎么用?PHP HTML2FPDF::WriteHTML使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTML2FPDF
的用法示例。
在下文中一共展示了HTML2FPDF::WriteHTML方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
function event_espresso_generat_pdf($name = "Invoice", $content)
{
require_once 'html2fpdf.php';
//exit($content);
$pdf = new HTML2FPDF('P', 'mm', 'Letter');
$pdf->AddPage();
$pdf->WriteHTML($content);
$pdf->Output($name . '.pdf', 'D');
}
示例2: Create
function Create()
{
$this->content = utf8_decode($this->_ParseHTML($this->content));
$pdf = new HTML2FPDF();
$pdf->ShowNOIMG_GIF();
$pdf->DisplayPreferences('HideWindowUI');
$pdf->AddPage();
$pdf->WriteHTML($this->content);
$pdf->Output(\Cx\Lib\FileSystem\FileSystem::replaceCharacters($this->title));
}
示例3: PDF_html_2_pdf
function PDF_html_2_pdf($data)
{
global $auth;
$pdf = new HTML2FPDF();
$pdf->UseCSS();
$pdf->UseTableHeader();
$pdf->AddPage();
$pdf->WriteHTML(AdjustHTML($data));
$pdf->Output();
}
示例4: Pdf_do
public function Pdf_do($config = array())
{
$source_name = $config['name'];
$task_name = $config['output'];
require 'htmlofpdf/html2fpdf.php';
$pdf = new HTML2FPDF();
$pdf->AddGBFont('GB', 'GB2312');
$pdf->AddPage();
$fp = fopen($source_name, "r");
$strContent = fread($fp, filesize($source_name));
fclose($fp);
$pdf->WriteHTML(iconv("UTF-8", "GB2312", $strContent));
ob_clean();
$pdf->Output($task_name, true);
}
示例5: createPDF
public function createPDF($url)
{
$url = 'http://clients.skiify.com/eximagen/en/boligrafos-plasticos/430-boligrafo-pilot.html';
require_once '/html2pdf/html2fpdf.php';
// Create new HTML2PDF class for an A4 page, measurements in mm
$pdf = new HTML2FPDF('P', 'mm', 'A4');
$buffer = file_get_contents($url);
var_dump($buffer);
// Optional top margin
$pdf->SetTopMargin(1);
$pdf->AddPage();
// Control the x-y position of the html
$pdf->SetXY(0, 0);
$pdf->WriteHTML($buffer);
// The 'D' arg forces the browser to download the file
$pdf->Output('MyFile.pdf', 'D');
}
示例6: getContent
//.........这里部分代码省略.........
}
global $sourceFolder;
global $moduleFolder;
require_once $sourceFolder . "/" . $moduleFolder . "/" . $moduleType . ".lib.php";
$page = new $moduleType();
if (!$page instanceof module) {
displayerror("The module \"{$moduleType}\" does not implement the inteface module</div>");
return "";
}
$createperms_query = " SELECT * FROM " . MYSQL_DATABASE_PREFIX . "permissionlist where perm_action = 'create' AND page_module = '" . $moduleType . "'";
$createperms_result = mysql_query($createperms_query);
if (mysql_num_rows($createperms_result) < 1) {
displayerror("The action \"create\" does not exist in the module \"{$moduleType}\"</div>");
return "";
}
$availableperms_query = "SELECT * FROM " . MYSQL_DATABASE_PREFIX . "permissionlist where perm_action != 'create' AND page_module = '" . $moduleType . "'";
$availableperms_result = mysql_query($availableperms_query);
$permlist = array();
while ($value = mysql_fetch_assoc($availableperms_result)) {
array_push($permlist, $value['perm_action']);
}
array_push($permlist, "view");
$class_methods = get_class_methods($moduleType);
foreach ($permlist as $perm) {
if (!in_array("action" . ucfirst($perm), $class_methods)) {
displayerror("The action \"{$perm}\" does not exist in the module \"{$moduleType}\"</div>");
return "";
}
}
if ($action == "pdf") {
if (isset($_GET['depth'])) {
$depth = $_GET['depth'];
} else {
$depth = 0;
}
if (!is_numeric($depth)) {
$depth = 0;
}
global $TITLE;
global $sourceFolder;
require_once "{$sourceFolder}/modules/pdf/html2fpdf.php";
$pdf = new HTML2FPDF();
$pdf->setModuleComponentId($moduleComponentId);
$pdf->AddPage();
$pdf->WriteHTML($page->getHtml($userId, $moduleComponentId, "view"));
$cp = array();
$j = 0;
if ($depth == -1) {
$cp = child($pageId, $userId, $depth);
if ($cp[0][0]) {
for ($i = 0; $cp[$i][0] != NULL; $i++) {
require_once $sourceFolder . "/" . $moduleFolder . "/" . $cp[$i][2] . ".lib.php";
$page1 = new $cp[$i][2]();
$modCompId = $cp[$i][5];
$pdf->setModuleComponentId($modCompId);
$pdf->AddPage();
$pdf->WriteHTML($page1->getHtml($userId, $modCompId, "view"));
}
}
} else {
if ($depth > 0) {
$cp = child($pageId, $userId, $depth);
--$depth;
while ($depth > 0) {
$count = count($cp);
for ($j; $j < $count; $j++) {
$cp = array_merge((array) $cp, (array) child($cp[$j][0], $userId, $depth));
}
--$depth;
}
if ($cp[0][0]) {
for ($i = 0; isset($cp[$i]); $i++) {
require_once $sourceFolder . "/" . $moduleFolder . "/" . $cp[$i][2] . ".lib.php";
$page1 = new $cp[$i][2]();
$modCompId = $cp[$i][5];
$pdf->setModuleComponentId($modCompId);
$pdf->AddPage();
$pdf->WriteHTML($page1->getHtml($userId, $modCompId, "view"));
}
}
}
}
$filePath = $sourceFolder . "/uploads/temp/" . $TITLE . ".pdf";
while (file_exists($filePath)) {
$filePath = $sourceFolder . "/uploads/temp/" . $TITLE . "-" . rand() . ".pdf";
}
$pdf->Output($filePath);
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private", false);
header("Content-Type: application/pdf");
header("Content-Disposition: attachment; filename=\"" . basename($filePath) . "\";");
header("Content-Transfer-Encoding: binary");
header("Content-Length: " . filesize($filePath));
@readfile("{$filePath}");
unlink($filePath);
}
return $page->getHtml($userId, $moduleComponentId, $action);
}
示例7: createPDF
function createPDF()
{
global $smarty;
$smarty = new Smarty();
templateAssignInvoice('smarty', $this);
templateAssignSystemvars('smarty');
$smarty->assign('invoice_heading', 'Faktura');
$pdf = new HTML2FPDF();
$pdf->DisplayPreferences('HideWindowUI');
$pdf->AddPage();
$pdf->WriteHTML($smarty->fetch('file:invoice.tpl'));
$pdf->Output('invoice/invoice' . $this->invoice_id . '.pdf');
$smarty->assign('invoice_heading', 'Fakturakopi');
$pdf = new HTML2FPDF();
$pdf->DisplayPreferences('HideWindowUI');
$pdf->AddPage();
$pdf->WriteHTML($smarty->fetch('file:invoice.tpl'));
$pdf->Output('invoice/invoice' . $this->invoice_id . '_copy.pdf');
}
示例8: executeInvoice
public function executeInvoice(sfWebRequest $request)
{
sfLoader::loadHelpers(array("Asset", "Tag"));
$job = $this->getRoute()->getObject();
$pdf = new HTML2FPDF();
$img = "<img src='http://photo.tufts.edu/images/tufts_logo_226x78.jpg'></a>";
$date = date("F d, Y");
$jobId = $job->getId();
$publicationName = $job->getPublicationId() ? $job->getPublication()->getName() : "";
$jobDate = $job->getDate() ? $job->getDate("F d, Y") : "";
$total = $job->getEstimate() + $job->getProcessing();
$clients = "";
$photographers = "";
foreach ($job->getClients() as $i) {
$clients .= $i->getName() . "<br />";
$clients .= $i->getDepartment() . "<br />";
$clients .= $i->getAddress() . "<br />";
}
foreach ($job->getPhotographers() as $i) {
$photographers .= $i->getName() . ", " . $i->getAffiliation() . "<br><br>";
}
$invoiceHTML = <<<EOF
\t\t<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
\t\t<html>
\t\t <head><title></title></head>
\t\t <body>
<div style="width:600px;height:800px;">
<p style="margin-left:50px; float: left;">
{$img}
</p>
<p align="right" style="padding-right:50px;margin-top:-30px;font-family:arial;">
<b>University Relations</b>
<br><br>
University Photography
</p>
<div style="padding-left:20px;">
<p>({$date})</p>
<p><b>INVOICE #{$jobId}</b></p>
<p><b>Client (Bill to)</b></p>
{$clients}
<p><b>Job</b></p>
<p>Job #{$jobId}<br>
{$job->getEvent()}<br>
{$publicationName}<br>
</p>
<p>{$jobDate}<br>
{$job->getStartTime()} - {$job->getEndTime()}<br>
{$job->getPrettyAddress()}
</p>
<p><b>Charges</b></p>
<p>{$photographers}</p>
<p>
Shoot Fee: \${$job->getEstimate()}<br>
Processing: \${$job->getProcessing()}<br>
</p>
<b>TOTAL: \${$total}</b></div>
<div style="margin-top:75px;margin-left:10px;">
<p style="font-family:arial; color:#cccccc;">
80 George Street, Medford, MA 02155 | TEL: 617.627.3549 | FAX: 617.627.3549
</p>
</div>
</div>
</body>
</html>
EOF;
// $this->renderText($invoiceHTML);
$pdf->AddPage();
$pdf->WriteHTML($invoiceHTML);
$pdf->Output("", "I");
return sfView::NONE;
}
示例9: strtoupper
<tr class="fil">
<td><span>5.2 PRESUPUESTO DEL PROYECTO : <?php
echo strtoupper(utf8_encode($value[39]));
?>
</span> </td>
</tr>
<tr class="fil">
<td><span>5.3 FINANCIAMIENTO : <?php
echo strtoupper(utf8_encode($value[41]));
?>
</strong></span> </td>
</tr>
<?php
}
?>
</tbody></table>
</div>
<?php
$content = ob_get_clean();
$pdf = new HTML2FPDF('P', 'mm', 'A4', 'UTF-8');
$pdf->UseCSS($opt == true);
$pdf->AddPage();
$pdf->WriteHTML($content);
$pdf->ReadCSS($content);
$pdf->Output('proyecto.pdf');
?>
示例10: OutputReport
public function OutputReport($szOutputBuffer, &$szErrorStr)
{
global $gl_root_path;
// Helper variable, init with buffer
$szFinalOutput = $szOutputBuffer;
$res = SUCCESS;
// Simple HTML Output!
if ($this->_outputFormat == REPORT_OUTPUT_HTML) {
// do nothing
} else {
if ($this->_outputFormat == REPORT_OUTPUT_PDF) {
// Convert into PDF!
include_once $gl_root_path . 'classes/html2fpdf/html2fpdf.php';
// $pdf=new HTML2FPDF('landscape');
$pdf = new HTML2FPDF();
$pdf->UseCss(true);
$pdf->AddPage();
// $pdf->SetFontSize(12);
$pdf->WriteHTML($szOutputBuffer);
$szFinalOutput = $pdf->Output('', 'S');
// Output to STANDARD Input!
}
}
// Simple HTML Output!
if ($this->_outputTarget == REPORT_TARGET_STDOUT) {
// Check if we need another header
if ($this->_outputFormat == REPORT_OUTPUT_PDF) {
Header('Content-Type: application/pdf');
}
// Kindly output to browser
echo $szFinalOutput;
$res = SUCCESS;
} else {
if ($this->_outputTarget == REPORT_TARGET_FILE) {
// Get Filename first
if (isset($this->_arrOutputTargetDetails['filename'])) {
// Get Filename property
$szFilename = $this->_arrOutputTargetDetails['filename'];
// Create file and Write Report into it!
$handle = @fopen($szFilename, "w");
if ($handle === false) {
$szErrorStr = "Could not create '" . $szFilename . "'!";
$res = ERROR;
} else {
fwrite($handle, $szFinalOutput);
fflush($handle);
fclose($handle);
// For result
$szErrorStr = "Results were saved into '" . $szFilename . "'";
$res = SUCCESS;
}
} else {
$szErrorStr = "The parameter 'filename' was missing.";
$res = ERROR;
}
}
}
// return result
return $res;
}
示例11: iconv
$xtpl->assign("dividerSpan", 4);
//Assign DetailView Fileds
$xtpl->assign('name', $focus->name);
$xtpl->assign('account_name', $focus->account_name);
$xtpl->assign('account_id', $focus->account_id);
$xtpl->assign('contact_name', $focus->contact_name);
$xtpl->assign('contact_id', $focus->contact_id);
$xtpl->assign('assigned_user_name', $focus->assigned_user_name);
$xtpl->assign('description', nl2br(url2html($focus->description)));
$xtpl->assign('vision', $focus->vision);
$xtpl->assign('period', $app_list_strings['clientorders_period_options'][$focus->period]);
$xtpl->assign('pnum', $focus->number);
$xtpl->assign('category', $app_list_strings['clientorders_category_options'][$focus->category]);
$xtpl->assign('note', $focus->note);
$xtpl->assign('quantity', $focus->quantity);
$xtpl->assign('status', $app_list_strings['clientorder_component_status'][$focus->status]);
$xtpl->assign('samples', $focus->samples);
$xtpl->assign('file', $focus->file);
$xtpl->assign('deadline', $focus->deadline);
$xtpl->assign('date_entered', $focus->date_entered);
$xtpl->assign('date_modified', $focus->date_modified);
$pdf->DisplayPreferences('HideWindowUI');
$pdf->AddPage();
$xtpl->parse("main");
$html = $xtpl->pdf_out('main');
$html_encoded = iconv('utf-8', 'CP1251', $html);
$pdf->UseCSS(true);
$pdf->DisableTags();
$pdf->WriteHTML($html_encoded);
//echo $html_encoded;
$pdf->Output("{$focus->number}.pdf", 'D');
示例12: include
<?php
/* ob_start();
include("../../view/template/receipt.php");
$content = ob_get_clean();*/
$htmlfile = "http://localhost/source/view/template/receipt.php";
require "html2pdf.class.php";
try {
$html2pdf = new HTML2FPDF('P', 'mm', 'Letter');
// $fp = fopen("../../view/template/receipt.php", "r");
$contents = file_get_contents($htmlfile);
// fclose($fp);
// echo $contents;
$html2pdf->WriteHTML($contents);
$html2pdf->Output('receipt.pdf');
} catch (HTML2PDF_exception $e) {
echo $e;
exit;
}
示例13: die2
if ($pfDebug) {
echo @"\n<style type=\"text/css\">\n#debugdiv {\nfloat: none;\nposition: absolute;\n/*top: 120;\nleft: 500;*/\ndisplay: none;\n}\n</style>\n<script language=\"javascript\">\nfunction toggleDebugDiv() {\n var dbgdiv = document.getElementById('debugdiv'); \n var displ = dbgdiv.style.display;\n if ((displ == 'none') || (displ == '')) {\n dbgdiv.style.display = 'block';\n } else {\n dbgdiv.style.display = 'none'; \n }\n}\n</script>\n";
echo '<div style="text-align: left;"><a href="javascript: toggleDebugDiv();" />DEBUG:</a></div><div id="debugdiv"><table style="background-color: aliceblue; padding: 8pt; border: thick dotted khaki; width: 700px; margin-top: 24pt;"><tr><td><h2>performs.php</h2></td></tr><tr><td>';
$tabs = new mosTabs(0);
//startTab (joomla.php line 4318 version 1.0.11) only ever adds tabs to tabPane1 ...
$tabs->startPane("session");
report_env($tabs, 1);
// $tabs->startTab("MAKE", 'session');
}
/*============================================================================*/
$strResult = $objMyForm->make();
if ($pfDebug) {
$tabs->endTab();
$tabs->endPane();
}
if ($printpdf) {
$pdf = new HTML2FPDF();
$pdf->DisplayPreferences('HideWindowUI');
$pdf->AddPage();
$pdf->WriteHTML($strResult);
ob_end_clean();
$pdf->Output('doc.pdf', 'D');
} else {
echo $strResult;
}
}
function die2($dietxt)
{
global $pfDebug;
die($dietxt);
}
示例14: _print_pdf
function _print_pdf($file, $data)
{
require_once 'h2p/html2fpdf.php';
// agar dapat menggunakan fungsi-fungsi html2pdf
ob_start();
// memulai buffer
error_reporting(1);
// turn off warning for deprecated functions
$pdf = new HTML2FPDF();
// membuat objek HTML2PDF
$pdf->DisplayPreferences('Fullscreen');
$html = $data;
// mengambil data dengan format html, dan disimpan di variabel
ob_end_clean();
// mengakhiri buffer dan tidak menampilkan data dalam format html
$pdf->addPage();
// menambah halaman di file pdf
$pdf->WriteHTML($html);
// menuliskan data dengan format html ke file pdf
return $pdf->Output($file, 'D');
}
示例15: EmailInvoice
//.........这里部分代码省略.........
display_2bill($prvat);
?>
</b></font></td>
</tr>
<tr>
<td><img src="<?php
echo Images_Path;
?>
/spacer.jpg" align="middle" height="30px"></td>
</tr>
<tr bgcolor="#CCCCCC" >
<td align="right" width="100%"><font color="#003399"><b><?php
echo gettext("Grand Total");
?>
= <?php
echo display_2bill($totalcost + $prvat);
?>
</b></font></td>
</tr>
<tr>
<td><img src="<?php
echo Images_Path;
?>
/spacer.jpg" align="middle" height="30px"></td>
</tr>
</table>
<table cellspacing="0" cellpadding="2" width="80%" align="center">
<tr>
<td colspan="3"> </td>
</tr>
<tr>
<td align="left">Status : <?php
if ($info_customer[0][12] == 't') {
?>
<img src="<?php
echo Images_Path;
?>
/connected.jpg">
<?php
} else {
?>
<img src="<?php
echo Images_Path;
?>
/terminated.jpg">
<?php
}
?>
</td>
</tr>
<tr>
<td align="left"> <img src="<?php
echo Images_Path;
?>
/connected.jpg"> <?php
echo gettext("Connected");
?>
<img src="<?php
echo Images_Path;
?>
/terminated.jpg"> <?php
echo gettext("Disconnected");
?>
</td>
</table>
<?php
$html = ob_get_contents();
// delete output-Buffer
ob_end_clean();
$pdf = new HTML2FPDF();
$pdf->DisplayPreferences('HideWindowUI');
$pdf->AddPage();
$pdf->WriteHTML($html);
$stream = $pdf->Output('UnBilledDetails_' . date("d/m/Y-H:i") . '.pdf', 'S');
//================================Email Template Retrival Code ===================================
$QUERY = "SELECT mailtype, fromemail, fromname, subject, messagetext, messagehtml FROM cc_templatemail WHERE mailtype='invoice' ";
$res = $DBHandle->Execute($QUERY);
$num = 0;
if ($res) {
$num = $res->RecordCount();
}
if (!$num) {
echo "<br>Error : No email Template Found";
exit;
}
for ($i = 0; $i < $num; $i++) {
$listtemplate[] = $res->fetchRow();
}
list($mailtype, $from, $fromname, $subject, $messagetext, $messagehtml) = $listtemplate[0];
if ($FG_DEBUG == 1) {
echo "<br><b>mailtype : </b>{$mailtype}</br><b>from:</b> {$from}</br><b>fromname :</b> {$fromname}</br><b>subject</b> : {$subject}</br><b>ContentTemplate:</b></br><pre>{$messagetext}</pre></br><hr>";
}
//================================================================================================
$ok = send_email_attachment($from, $info_customer[0][10], $subject, $messagetext, 'UnBilledDetails_' . date("d/m/Y-H:i") . '.pdf', $stream);
return $ok;
}