本文整理汇总了PHP中HTML2FPDF类的典型用法代码示例。如果您正苦于以下问题:PHP HTML2FPDF类的具体用法?PHP HTML2FPDF怎么用?PHP HTML2FPDF使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了HTML2FPDF类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fopen
<?php
$handle = fopen("invoice_gen.html", 'w+');
if ($handle) {
if (!fwrite($handle, "<table border=1px>\n\t <tr> <td>dfddfdfdf</td></tr>\t\n\t</table>")) {
die("couldn't write to file.");
}
echo "success writing to file";
}
require 'html2fpdf.php';
$pdf = new HTML2FPDF();
$pdf->AddPage();
$fp = fopen("invoice_gen.html", "r");
$strContent = fread($fp, filesize("invoice_gen.html"));
fclose($fp);
$pdf->WriteHTML($strContent);
$pdf->Output("invoice_gen.pdf");
echo "PDF file is generated successfully!";
示例2: event_espresso_generat_pdf
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');
}
示例3: 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);
}
示例4: pdf
function pdf()
{
exit("deactivated for now...");
if ($ID = Director::urlParam("ID")) {
if ($invoice = DataObject::get_one("ShopInvoice", "PublicURL = '" . Convert::Raw2SQL($ID) . "'")) {
$this->Invoice = $invoice;
if (!isset($_REQUEST['view'])) {
//generate pdf
require dirname(__FILE__) . '/Thirdparty/html2fpdf/html2fpdf.php';
//to get work HTML2PDF
error_reporting(E_ALL ^ (E_NOTICE | E_DEPRECATED));
$pdf = new HTML2FPDF();
$pdf->AddPage();
$pdfPath = $invoice->generatePDF();
$outputPath = TEMP_FOLDER . "/shopsystem/";
$outputFile = $outputPath . $invoice->PublicURL . ".pdf";
$fp = fopen($pdfPath, "r");
$strContent = fread($fp, filesize($pdfPath));
fclose($fp);
$pdf->WriteHTML($strContent);
$pdf->Output($outputFile);
header('Content-type: application/pdf');
header('Content-Disposition: attachment; filename="invoice.pdf"');
echo file_get_contents($outputFile);
//PDF file is generated successfully!
exit;
}
if (isset($_REQUEST['remove'])) {
//remove invoice from public by generating a new public url
$invoice->PublicURL = ShopInvoice::generatePublicURL();
$invoice->write();
}
}
}
return array();
}
示例5: 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));
}
示例6: 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();
}
示例7: 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');
}
示例8: FullScreen
echo $r[unidad_medida];
?>
</td>
<td align="right"><?php
echo $r[meta_anp_objetivo_especifico];
?>
</td>
</tr>
<?php
}
}
?>
</table>
<script language="javascript">
FullScreen();
</script>
</body>
</html>
<?php
if ($_GET[pdf] == 'ok') {
$htmlbuffer = ob_get_contents();
ob_end_clean();
header("Content-type: application/pdf");
$pdf = new HTML2FPDF('P', 'mm', 'a4');
$pdf->ubic_css = "../../style.css";
//agreg mio
$pdf->DisplayPreferences('HideWindowUI');
$pdf->AddPage();
$pdf->WriteHTML($htmlbuffer);
$pdf->Output('reporte.pdf', 'D');
}
示例9: getAdvancedReportPDF
//.........这里部分代码省略.........
$i_isok = !$i_rSet2->EOF;
}
if ($i_isok) {
$i_isok = $i_rSet3 = $g_db->SelectLimit("SELECT * FROM " . $srv_settings['table_prefix'] . "tests WHERE testid=" . $i_rSet2->fields['testid'], 1);
}
if ($i_isok) {
$i_isok = !$i_rSet3->EOF;
}
if ($i_isok) {
$i_isok = $i_rSet3->fields['rtemplateid'] > 0 && ($i_rSet3->fields['test_reportgradecondition'] == 0 || $i_rSet3->fields['test_reportgradecondition'] >= $i_rSet2->fields['gscale_gradeid']);
}
if ($i_isok) {
$i_isok = $i_rSet6 = $g_db->SelectLimit("SELECT * FROM " . $srv_settings['table_prefix'] . "users WHERE id=" . $i_rSet2->fields['id'], 1);
}
if ($i_isok) {
$i_isok = !$i_rSet6->EOF;
}
$i_result_detailed_1_items = array();
$i_result_detailed_2_items = array();
$i_result_detailed_3_items = array();
$i_result_detailed_4_items = array();
if ($i_isok) {
$i_isok = $i_rSet7 = $g_db->Execute("SELECT * FROM " . $srv_settings['table_prefix'] . "results_answers, " . $srv_settings['table_prefix'] . "questions WHERE resultid=" . $resultid . " AND " . $srv_settings['table_prefix'] . "results_answers.questionid=" . $srv_settings['table_prefix'] . "questions.questionid ORDER BY result_answerid");
}
if ($i_isok) {
$i_questionno = 0;
while (!$i_rSet7->EOF) {
$i_questionno++;
$i_answers = array();
$i_rSet5 = $g_db->Execute("SELECT answer_text, answer_correct FROM " . $srv_settings['table_prefix'] . "answers WHERE questionid=" . $i_rSet7->fields['questionid'] . " ORDER BY answerid");
if (!$i_rSet5) {
showDBError(__FILE__, 5);
} else {
$i_answerno = 1;
while (!$i_rSet5->EOF) {
$i_answers[$i_answerno] = $i_rSet5->fields['answer_text'];
$i_answers_correct[$i_answerno] = $i_rSet5->fields['answer_correct'];
$i_answerno++;
$i_rSet5->MoveNext();
}
$i_rSet5->Close();
}
$i_detailed_correct = $i_rSet7->fields['result_answer_iscorrect'] == IGT_ANSWER_IS_CORRECT;
$i_result_detailed_3_items[$i_questionno] = $i_questionno . '. ' . getTruncatedHTML($i_rSet7->fields['question_text'], 0);
$i_result_detailed_1_items[$i_questionno] = $i_result_detailed_3_items[$i_questionno] . '<br />';
$i_result_detailed_1_items[$i_questionno] .= $lngstr['email_answer_iscorrect'] . ($i_rSet7->fields['result_answer_iscorrect'] == IGT_ANSWER_IS_UNDEFINED ? $lngstr['label_undefined'] : ($i_rSet7->fields['result_answer_iscorrect'] == IGT_ANSWER_IS_CORRECT ? $lngstr['label_yes'] : ($i_rSet7->fields['result_answer_iscorrect'] == IGT_ANSWER_IS_PARTIALLYCORRECT ? $lngstr['label_partially'] : $lngstr['label_no']))) . '<br />';
$i_result_detailed_1_items[$i_questionno] .= $lngstr['email_answer_points'] . $i_rSet7->fields['result_answer_points'] . '<br />';
if (!$i_detailed_correct) {
$i_result_detailed_2_items[$i_questionno] = $i_result_detailed_1_items[$i_questionno];
}
$i_result_detailed_3_items[$i_questionno] = '<tr><td>' . $i_result_detailed_3_items[$i_questionno] . '</td></tr>';
for ($i = 1; $i < $i_answerno; $i++) {
switch ($i_rSet7->fields['question_type']) {
case QUESTION_TYPE_MULTIPLECHOICE:
case QUESTION_TYPE_TRUEFALSE:
$i_answers_given = (int) $i_rSet7->fields['result_answer_text'];
$i_result_detailed_3_items[$i_questionno] .= '<tr><td><img src="images/button-checkbox-' . ($i_answers_correct[$i] ? '2' : ($i == $i_answers_given ? '4' : '0')) . '.gif" width=13 height=13> ' . $i_answers[$i] . '</tr>';
break;
case QUESTION_TYPE_MULTIPLEANSWER:
$i_answers_given = explode(QUESTION_TYPE_MULTIPLEANSWER_BREAK, $i_rSet7->fields['result_answer_text']);
$i_result_detailed_3_items[$i_questionno] .= '<tr><td><img src="images/button-checkbox-' . ($i_answers_correct[$i] ? '2' : (in_array($i, $i_answers_given) ? '4' : '0')) . '.gif" width=13 height=13> ' . $i_answers[$i] . '</tr>';
break;
case QUESTION_TYPE_FILLINTHEBLANK:
$i_result_detailed_3_items[$i_questionno] .= '<tr><td>' . nl2br($i_answers[$i]) . '</td></tr>';
break;
}
}
if ($i_rSet7->fields['question_type'] == QUESTION_TYPE_ESSAY) {
$i_result_detailed_3_items[$i_questionno] .= '<tr><td>' . nl2br($i_rSet7->fields['result_answer_text']) . '</td></tr>';
}
$i_result_detailed_3_items[$i_questionno] .= '<tr><td>' . $lngstr['email_answer_points'] . $i_rSet7->fields['result_answer_points'] . '</td></tr>';
if (!$i_detailed_correct) {
$i_result_detailed_4_items[$i_questionno] = $i_result_detailed_3_items[$i_questionno];
}
$i_rSet7->MoveNext();
}
$i_rSet7->Close();
$i_result_detailed_1_text = implode('<br />', $i_result_detailed_1_items);
$i_result_detailed_2_text = implode('<br />', $i_result_detailed_2_items);
$i_result_detailed_3_text = '<table cellpadding=0 cellspacing=0 border=0 width="100%">' . implode("\n", $i_result_detailed_3_items) . '</table>';
$i_result_detailed_4_text = '<table cellpadding=0 cellspacing=0 border=0 width="100%">' . implode("\n", $i_result_detailed_4_items) . '</table>';
$i_result_detailed_5_text = '';
$i_result_detailed_6_text = '';
$i_pdf = eventOnQueryCustomReportPDF();
if (empty($i_pdf)) {
$i_pdf = new HTML2FPDF();
$i_pdf->AddPage();
$i_pdf->SetFont('Arial', '', 11);
$i_pdf->SetTextColor(0, 0, 0);
$g_vars['page']['grade'] = getGradeData($i_rSet2->fields['gscaleid'], $i_rSet2->fields['gscale_gradeid']);
$g_vars['page']['subjects'] = getTestResultSubjectsData($resultid);
$i_template_body = getReportTemplate(array('rtemplateid' => $i_rSet3->fields['rtemplateid'], 'username' => $i_rSet6->fields['username'], 'email' => $i_rSet6->fields['email'], 'title' => $i_rSet6->fields['user_title'], 'firstname' => $i_rSet6->fields['user_firstname'], 'lastname' => $i_rSet6->fields['user_lastname'], 'middlename' => $i_rSet6->fields['user_middlename'], 'address' => $i_rSet6->fields['user_address'], 'city' => $i_rSet6->fields['user_city'], 'state' => $i_rSet6->fields['user_state'], 'zip' => $i_rSet6->fields['user_zip'], 'country' => $i_rSet6->fields['user_country'], 'phone' => $i_rSet6->fields['user_phone'], 'fax' => $i_rSet6->fields['user_fax'], 'mobile' => $i_rSet6->fields['user_mobile'], 'pager' => $i_rSet6->fields['user_pager'], 'ipphone' => $i_rSet6->fields['user_ipphone'], 'webpage' => $i_rSet6->fields['user_webpage'], 'icq' => $i_rSet6->fields['user_icq'], 'msn' => $i_rSet6->fields['user_msn'], 'aol' => $i_rSet6->fields['user_aol'], 'gender' => $i_rSet6->fields['user_gender'], 'birthday' => $i_rSet6->fields['user_birthday'], 'husbandwife' => $i_rSet6->fields['user_husbandwife'], 'children' => $i_rSet6->fields['user_children'], 'trainer' => $i_rSet6->fields['user_trainer'], 'photo' => $i_rSet6->fields['user_photo'], 'company' => $i_rSet6->fields['user_company'], 'cposition' => $i_rSet6->fields['user_cposition'], 'department' => $i_rSet6->fields['user_department'], 'coffice' => $i_rSet6->fields['user_coffice'], 'caddress' => $i_rSet6->fields['user_caddress'], 'ccity' => $i_rSet6->fields['user_ccity'], 'cstate' => $i_rSet6->fields['user_cstate'], 'czip' => $i_rSet6->fields['user_czip'], 'ccountry' => $i_rSet6->fields['user_ccountry'], 'cphone' => $i_rSet6->fields['user_cphone'], 'cfax' => $i_rSet6->fields['user_cfax'], 'cmobile' => $i_rSet6->fields['user_cmobile'], 'cpager' => $i_rSet6->fields['user_cpager'], 'cipphone' => $i_rSet6->fields['user_cipphone'], 'cwebpage' => $i_rSet6->fields['user_cwebpage'], 'cphoto' => $i_rSet6->fields['user_cphoto'], 'ufield1' => $i_rSet6->fields['user_ufield1'], 'ufield2' => $i_rSet6->fields['user_ufield2'], 'ufield3' => $i_rSet6->fields['user_ufield3'], 'ufield4' => $i_rSet6->fields['user_ufield4'], 'ufield5' => $i_rSet6->fields['user_ufield5'], 'ufield6' => $i_rSet6->fields['user_ufield6'], 'ufield7' => $i_rSet6->fields['user_ufield7'], 'ufield8' => $i_rSet6->fields['user_ufield8'], 'ufield9' => $i_rSet6->fields['user_ufield9'], 'ufield10' => $i_rSet6->fields['user_ufield10'], 'test_name' => $i_rSet3->fields['test_name'], 'result_id' => $resultid, 'result_date' => getDateLocal($lngstr['language']['date_format_full'], $i_rSet2->fields['result_datestart']), 'result_time_spent' => getTimeFormatted($i_rSet2->fields['result_timespent']), 'result_time_exceeded' => $i_rSet2->fields['result_timeexceeded'] > 0 ? $lngstr['label_yes'] : $lngstr['label_no'], 'result_points_scored' => $i_rSet2->fields['result_points'], 'result_points_possible' => $i_rSet2->fields['result_pointsmax'], 'result_percents' => $i_rSet2->fields['result_pointsmax'] > 0 ? round($i_rSet2->fields['result_points'] * 100 / $i_rSet2->fields['result_pointsmax']) : 0, 'result_grade' => $g_vars['page']['grade']['name'], 'result_grade_feedback' => $g_vars['page']['grade']['feedback'], 'result_subjects' => $g_vars['page']['subjects'], 'result_detailed_1' => $i_result_detailed_1_text, 'result_detailed_2' => $i_result_detailed_2_text, 'result_detailed_3' => $i_result_detailed_3_text, 'result_detailed_4' => $i_result_detailed_4_text, 'result_detailed_5' => $i_result_detailed_5_text, 'result_detailed_6' => $i_result_detailed_6_text));
$i_pdf->WriteHTML($i_template_body);
}
} else {
$i_pdf = false;
}
ob_end_clean();
return $i_pdf;
}
示例10: gettext
<img src="<?php
echo Images_Path;
?>
/terminated.jpg"> <?php
echo gettext("Disconnected");
?>
</td>
</table>
<?php
if ($exporttype != "pdf") {
?>
<?php
//include( 'footer.php');
?>
<?php
} else {
// EXPORT TO PDF
$html = ob_get_contents();
// delete output-Buffer
ob_end_clean();
$pdf = new HTML2FPDF();
$pdf->DisplayPreferences('HideWindowUI');
$pdf->AddPage();
$pdf->WriteHTML($html);
$pdf->Output('UnBilledDetails_' . date("d/m/Y-H:i") . '.pdf', 'I');
}
示例11: DisplayPDF
function DisplayPDF($smarty, $invoicetype, $template)
{
require_once 'pdf-invoices/html2pdf/html2fpdf.php';
$pdf = new HTML2FPDF();
$pdf->DisplayPreferences('HideWindowUI');
$pdf->AddPage();
$pdf->WriteHTML($this->GetHTML($smarty, $invoicetype, $template));
// TODO: find a better name
return $pdf->Output('Invoice_' . date("d/m/Y-H:i") . '.pdf', 'I');
}
示例12: 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);
}
示例13: str_pad
else*/
if ($lessonIndex !== false) {
$html .= "bgcolor=\"#" . str_pad(dechex(isset($colors[$bookings[$lessonIndex][0]][0]) ? $colors[$bookings[$lessonIndex][0]][0] : 200), 2, "0", STR_PAD_LEFT) . str_pad(dechex(isset($colors[$bookings[$lessonIndex][0]][1]) ? $colors[$bookings[$lessonIndex][0]][1] : 200), 2, "0", STR_PAD_LEFT) . str_pad(dechex(isset($colors[$bookings[$lessonIndex][0]][2]) ? $colors[$bookings[$lessonIndex][0]][2] : 200), 2, "0", STR_PAD_LEFT) . "\"";
}
$html .= ">";
if ($lessonIndex !== false) {
$html .= "<font color=\"#" . str_pad(dechex(getSingleContrastColor(isset($colors[$bookings[$lessonIndex][0]][0]) ? $colors[$bookings[$lessonIndex][0]][0] : 200)), 2, "0", STR_PAD_LEFT) . str_pad(dechex(getSingleContrastColor(isset($colors[$bookings[$lessonIndex][0]][1]) ? $colors[$bookings[$lessonIndex][0]][1] : 200)), 2, "0", STR_PAD_LEFT) . str_pad(dechex(getSingleContrastColor(isset($colors[$bookings[$lessonIndex][0]][2]) ? $colors[$bookings[$lessonIndex][0]][2] : 200)), 2, "0", STR_PAD_LEFT) . "\">";
}
if ($lessonIndex !== false) {
$html .= $bookings[$lessonIndex][2];
} else {
$html .= " ";
}
if ($lessonIndex !== false) {
$html .= '</font>';
}
$html .= "</td>";
}
$html .= "</tr>";
}
$html .= '</table>';
}
$html .= '</body>
</html>';
$pdf = new HTML2FPDF("L");
$pdf->AddPage();
$pdf->WriteHTML($html);
//echo $html;
$pdf->Output();
//Outputs on browser screen
//$pdf->Output('antrag.pdf'); // save document on server
示例14: array
{
$farr = array(
"/\s+/", //过滤多余空白
//过滤 <script>等可能引入恶意内容或恶意改变显示布局的代码,如果不需要插入flash等,还可以加入<object>的过滤
"/<(\/?)(script|i?frame|style|html|body|title|link|meta|INPUT|A|img|\?|\%)([^>]*?)>/isU",
"/(<[^>]*)on[a-zA-Z]+\s*=([^>]*>)/isU",//过滤javascript的on事件
);
$tarr = array(
" ",
"",//如果要直接清除不安全的标签,这里可以留空
"",
);
$str = preg_replace( $farr,$tarr,$str);
return $str;
}
$pdf=new HTML2FPDF();
$pdf->AddGBFont('GB','仿宋_GB2312');
$pdf->SetFontSize('8');
$pdf->AddPage();
$fp = fopen("sample.html","r");
$strContent = fread($fp, filesize("sample.html"));
fclose($fp);
$msg=urldecode($_POST['userdefine']);
$msg=str_replace("class=TableBlock", "border=1", $msg);
$msg=str_replace("class=TableHeader", "bgcolor=#DDDDDD", $msg);
$msg=str_replace("class=TableContent", "bgcolor=#EEEEEE", $msg);
$msg=str_replace("class=TableDatat", "bgcolor=#FFFFFF", $msg);
$msg=str_replace("<tr>", "<TR>", $msg);
$msg=str_replace("</tr>", "</TR>", $msg);
$msg=str_replace("<td", "<TD", $msg);
$msg=str_replace("</td>", "</TD>", $msg);
示例15: load
<?php
function load($url)
{
curl_setopt($curld, CURLOPT_URL, $url);
curl_setopt($curld, CURLOPT_RETURNTRANSFER, true);
$output = curl_exec($curld);
curl_close($curld);
return $output;
}
ob_start();
echo load("http://localhost/nuker/");
$htmlbuffer = ob_get_contents();
ob_end_clean();
require '../html2fpdf/html2fpdf.php';
$pdf = new HTML2FPDF();
$pdf->AddPage();
$pdf->WriteHTML($htmlbuffer);
$pdf->Output('doc.pdf', 'I');