本文整理汇总了PHP中HTML2PDF::setTestIsImage方法的典型用法代码示例。如果您正苦于以下问题:PHP HTML2PDF::setTestIsImage方法的具体用法?PHP HTML2PDF::setTestIsImage怎么用?PHP HTML2PDF::setTestIsImage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTML2PDF
的用法示例。
在下文中一共展示了HTML2PDF::setTestIsImage方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: date
<?php
if (str_word_count($pieces > 0)) {
?>
<img src="<?php
echo "http://www.merlatrav.esy.es/" . $pieces[0]->url();
?>
" style="width:100%">
<?php
}
?>
<page_footer>
<hr/>
<p style="text-align: center"></p>
</page_footer>
</page>
<?php
$content = ob_get_clean();
require '../lib/html2pdf/html2pdf.class.php';
try {
$pdf = new HTML2PDF('P', 'A4', 'fr');
$pdf->pdf->SetDisplayMode('fullpage');
$pdf->setTestIsImage(false);
$pdf->writeHTML($content);
$fileName = "FicheDescriptifLocalCom-" . $local->nom() . "-" . date('Y-m-d-h-i') . '.pdf';
$pdf->Output($fileName);
} catch (HTML2PDF_exception $e) {
die($e->getMessage());
}
} else {
header("Location:index.php");
}
示例2: generateHtml2pdf
public function generateHtml2pdf($sUID, $aFields, $sPath, $sFilename, $sContent, $sLandscape = false, $aProperties = array())
{
// define("MAX_FREE_FRACTION", 1);
define('PATH_OUTPUT_FILE_DIRECTORY', PATH_HTML . 'files/' . $_SESSION['APPLICATION'] . '/outdocs/');
G::verifyPath(PATH_OUTPUT_FILE_DIRECTORY, true);
require_once PATH_THIRDPARTY . 'html2pdf/html2pdf.class.php';
// define Save file
$sOutput = 2;
$sOrientation = $sLandscape == false ? 'P' : 'L';
$sLang = defined('SYS_LANG') ? SYS_LANG : 'en';
$sMedia = $aProperties['media'];
// margin define
define("MINIMAL_MARGIN", 15);
$marges = array(MINIMAL_MARGIN, MINIMAL_MARGIN, MINIMAL_MARGIN, MINIMAL_MARGIN);
if (isset($aProperties['margins'])) {
// Default marges (left, top, right, bottom)
$margins = $aProperties['margins'];
$margins['left'] = $margins['left'] > 0 ? $margins['left'] : MINIMAL_MARGIN;
$margins['top'] = $margins['top'] > 0 ? $margins['top'] : MINIMAL_MARGIN;
$margins['right'] = $margins['right'] > 0 ? $margins['right'] : MINIMAL_MARGIN;
$margins['bottom'] = $margins['bottom'] > 0 ? $margins['bottom'] : MINIMAL_MARGIN;
$marges = array($margins['left'], $margins['top'], $margins['right'], $margins['bottom']);
}
$html2pdf = new HTML2PDF($sOrientation, $sMedia, $sLang, true, 'UTF-8', $marges);
$html2pdf->pdf->SetAuthor($aFields['USR_USERNAME']);
$html2pdf->pdf->SetTitle('Processmaker');
$html2pdf->pdf->SetSubject($sFilename);
$html2pdf->pdf->SetCompression(true);
//$html2pdf->pdf->SetKeywords('HTML2PDF, TCPDF, processmaker');
if (isset($aProperties['pdfSecurity'])) {
$pdfSecurity = $aProperties['pdfSecurity'];
$userPass = G::decrypt($pdfSecurity['openPassword'], $sUID);
$ownerPass = $pdfSecurity['ownerPassword'] != '' ? G::decrypt($pdfSecurity['ownerPassword'], $sUID) : null;
$permissions = explode("|", $pdfSecurity['permissions']);
$html2pdf->pdf->SetProtection($permissions, $userPass, $ownerPass);
}
$html2pdf->setTestTdInOnePage(false);
$html2pdf->setTestIsImage(false);
$html2pdf->setTestIsDeprecated(false);
$html2pdf->writeHTML($html2pdf->getHtmlFromPage($sContent));
switch ($sOutput) {
case 0:
// Vrew browser
$html2pdf->Output($sPath . $sFilename . '.pdf', 'I');
break;
case 1:
// Donwnload
$html2pdf->Output($sPath . $sFilename . '.pdf', 'D');
break;
case 2:
// Save file
$html2pdf->Output($sPath . $sFilename . '.pdf', 'F');
break;
}
copy($sPath . $sFilename . '.html', PATH_OUTPUT_FILE_DIRECTORY . $sFilename . '.html');
copy(PATH_OUTPUT_FILE_DIRECTORY . $sFilename . '.pdf', $sPath . $sFilename . '.pdf');
unlink(PATH_OUTPUT_FILE_DIRECTORY . $sFilename . '.pdf');
unlink(PATH_OUTPUT_FILE_DIRECTORY . $sFilename . '.html');
}
示例3: GetChecklist
/**
*
*/
public function GetChecklist()
{
if (!$this->opt_order->getPrimaryKey()) {
$this->Edit();
return;
}
require_once __CA_LIB_DIR__ . "/core/Print/html2pdf/html2pdf.class.php";
$this->view->setVar('items', $this->opt_order->getItems());
try {
$vs_content = $this->render('loan_pdf_checklist_html.php');
$vo_html2pdf = new HTML2PDF('L', 'letter', 'en');
$vo_html2pdf->setDefaultFont("dejavusans");
$vo_html2pdf->setTestIsImage(false);
$vo_html2pdf->WriteHTML($vs_content);
header("Content-Disposition: attachment; filename=loan_checklist.pdf");
header("Content-type: application/pdf");
$vo_html2pdf->Output('loan_checklist.pdf');
$vb_printed_properly = true;
} catch (Exception $e) {
$vb_printed_properly = false;
$this->postError(3100, _t("Could not generate PDF"), "OrderEditorController->GetCheckList()");
}
}
示例4: ExportFullSchedule
public function ExportFullSchedule()
{
$sort = $this->getRequest()->getVar('sort') ? $this->getRequest()->getVar('sort') : 'day';
$show_desc = $this->getRequest()->getVar('show_desc') ? $this->getRequest()->getVar('show_desc') : false;
$base = Director::protocolAndHost();
if (is_null($this->Summit())) {
return $this->httpError(404, 'Sorry, summit not found');
}
$schedule = $this->Summit()->getSchedule();
$events = new ArrayList();
$sort_list = false;
foreach ($schedule as $event) {
switch ($sort) {
case 'day':
$group_label = $event->getDayLabel();
break;
case 'track':
if (!$event->isPresentation() || !$event->Category() || !$event->Category()->Title) {
continue 2;
}
$group_label = $event->Category()->Title;
$sort_list = true;
break;
case 'event_type':
$group_label = $event->Type->Type;
$sort_list = true;
break;
}
if ($group_array = $events->find('Group', $group_label)) {
$group_array->Events->push($event);
} else {
$group_array = new ArrayData(array('Group' => $group_label, 'Events' => new ArrayList()));
$group_array->Events->push($event);
$events->push($group_array);
}
}
if ($sort_list) {
$events->sort('Group');
}
$html_inner = $this->renderWith(array('SummitAppMySchedulePage_pdf'), array('Schedule' => $events, 'Summit' => $this->Summit(), 'ShowDescription' => $show_desc, 'Heading' => 'Full Schedule by ' . $sort));
$css = @file_get_contents($base . "/summit/css/summitapp-myschedule-pdf.css");
//create pdf
$file = FileUtils::convertToFileName('full-schedule') . '.pdf';
$html_outer = sprintf("<html><head><style>%s</style></head><body><div class='container'>%s</div></body></html>", $css, $html_inner);
try {
$html2pdf = new HTML2PDF('P', 'A4', 'en', true, 'UTF-8', array(15, 5, 15, 5));
$html2pdf->setTestIsImage(false);
$html2pdf->WriteHTML($html_outer);
//clean output buffer
ob_end_clean();
$html2pdf->Output($file, "D");
} catch (HTML2PDF_exception $e) {
$message = array('errno' => '', 'errstr' => $e->__toString(), 'errfile' => 'SummitAppSchedPage.php', 'errline' => '', 'errcontext' => '');
SS_Log::log($message, SS_Log::ERR);
$this->httpError(404, 'There was an error on PDF generation!');
}
}
示例5: pdf
public function pdf($request)
{
$file = FileUtils::convertToFileName($this->Title) . '.pdf';
$html_inner = $this->customise(array('BASEURL' => Director::protocolAndHost()))->renderWith("UserStoryPDF");
$base = Director::baseFolder();
$css = $base . "/themes/openstack/css/main.pdf.css";
$html_outer = sprintf("<html><head><style>%s</style></head><body><div class='container'>%s</div></body></html>", str_replace("@host", $base, @file_get_contents($css)), str_replace('"/assets/', '"' . Director::protocolAndHost() . '/assets/', $html_inner));
//for debug purposes
if (isset($_GET['view'])) {
echo $html_outer;
die;
}
try {
$html2pdf = new HTML2PDF('P', 'A4', 'en', true, 'UTF-8', array(15, 5, 15, 5));
$html2pdf->setTestIsImage(false);
$html2pdf->WriteHTML($html_outer);
//clean output buffer
ob_end_clean();
$html2pdf->Output($file, "D");
} catch (HTML2PDF_exception $e) {
$message = array('errno' => '', 'errstr' => $e->__toString(), 'errfile' => 'UserStory.php', 'errline' => '', 'errcontext' => '');
SS_Log::log($message, SS_Log::ERR);
$this->httpError(404, 'There was an error on PDF generation!');
}
}
示例6: createSubHTML
/**
* création d'un sous HTML2PDF pour la gestion des tableaux imbriqués
*
* @param HTML2PDF futur sous HTML2PDF passé en référence pour création
* @param integer marge eventuelle de l'objet si simulation d'un TD
* @return null
*/
function createSubHTML(&$sub_html, $cellmargin = 0)
{
// calcul de la largueur
if ($this->style->value['width']) {
$marge = $cellmargin * 2;
$marge += $this->style->value['padding']['l'] + $this->style->value['padding']['r'];
$marge += $this->style->value['border']['l']['width'] + $this->style->value['border']['r']['width'];
$marge = $this->pdf->getW() - $this->style->value['width'] + $marge;
} else {
$marge = $this->margeLeft + $this->margeRight;
}
//clonage
$sub_html = new HTML2PDF($this->sens, $this->format, $this->langue, array($this->defaultLeft, $this->defaultTop, $this->defaultRight, $this->defaultBottom));
$sub_html->setIsSubPart();
$sub_html->setEncoding($this->encoding);
$sub_html->setTestTdInOnePage($this->testTDin1page);
$sub_html->setTestIsImage($this->testIsImage);
$sub_html->setTestIsDeprecated($this->testIsDeprecated);
$sub_html->setDefaultFont($this->defaultFont);
$sub_html->style->css = $this->style->css;
$sub_html->style->css_keys = $this->style->css_keys;
$sub_html->pdf->cloneFontFrom($this->pdf);
$sub_html->style->table = $this->style->table;
$sub_html->style->value = $this->style->value;
$sub_html->style->setOnlyLeft();
$sub_html->setNewPage($this->format, $this->sens);
$sub_html->initSubHtml($marge, $this->page, $this->defLIST);
// initialisation des positions et autre
$sub_html->maxX = 0;
$sub_html->maxY = 0;
$sub_html->maxH = 0;
$sub_html->pdf->setXY(0, 0);
}
示例7: draft_pdf
public function draft_pdf()
{
$html_inner = '';
$marketplace_type = $this->request->param('MARKETPLACETYPE');
$instance_id = intval($this->request->param('ID'));
$base = Director::baseFolder();
$query = new QueryObject();
$query->addAndCondition(QueryCriteria::id('ID', $instance_id));
switch (strtolower($marketplace_type)) {
case 'distribution':
$distribution = $this->distribution_draft_repository->getBy($query);
if (!$distribution) {
throw new NotFoundEntityException('', '');
}
$render = new DistributionSapphireRender($distribution);
$distribution->IsPreview = true;
$html_inner = $render->pdf();
$css = @file_get_contents($base . "/marketplace/code/ui/admin/css/pdf.css");
break;
case 'appliance':
$appliance = $this->appliance_draft_repository->getBy($query);
$appliance->IsPreview = true;
$render = new ApplianceSapphireRender($appliance);
$html_inner = $render->pdf();
$css = @file_get_contents($base . "/marketplace/code/ui/admin/css/pdf.css");
break;
case 'public_cloud':
$public_cloud = $this->public_clouds_draft_repository->getBy($query);
$public_cloud->IsPreview = true;
if (!$public_cloud) {
throw new NotFoundEntityException('', '');
}
$render = new PublicCloudSapphireRender($public_cloud);
$html_inner = $render->pdf();
$css = @file_get_contents($base . "/marketplace/code/ui/admin/css/pdf.css");
break;
case 'private_cloud':
$private_cloud = $this->private_clouds_draft_repository->getBy($query);
$private_cloud->IsPreview = true;
$render = new PrivateCloudSapphireRender($private_cloud);
$html_inner = $render->pdf();
$css = @file_get_contents($base . "/marketplace/code/ui/admin/css/pdf.css");
break;
case 'consultant':
$consultant = $this->consultant_draft_repository->getBy($query);
if (!$consultant) {
throw new NotFoundEntityException('', '');
}
$consultant->IsPreview = true;
$render = new ConsultantSapphireRender($consultant);
$html_inner = $render->pdf();
$css = @file_get_contents($base . "/marketplace/code/ui/admin/css/pdf.css");
break;
default:
$this->httpError(404);
break;
}
//create pdf
$file = FileUtils::convertToFileName('preview') . '.pdf';
$html_outer = sprintf("<html><head><style>%s</style></head><body><div class='container'>%s</div></body></html>", str_replace("@host", $base, $css), $html_inner);
try {
$html2pdf = new HTML2PDF('P', 'A4', 'en', true, 'UTF-8', array(15, 5, 15, 5));
//$html2pdf->addFont('Open Sans', '', $base.'/themes/openstack/assets/fonts/PT-Sans/PTC75F-webfont.ttf');
$html2pdf->setTestIsImage(false);
$html2pdf->WriteHTML($html_outer);
//clean output buffer
ob_end_clean();
$html2pdf->Output($file, "D");
} catch (HTML2PDF_exception $e) {
$message = array('errno' => '', 'errstr' => $e->__toString(), 'errfile' => 'UserStory.php', 'errline' => '', 'errcontext' => '');
SS_Log::log($message, SS_Log::ERR);
$this->httpError(404, 'There was an error on PDF generation!');
}
}
示例8: _genExport
//.........这里部分代码省略.........
// if(sizeof($va_buf) == 1) { // single record - output as file
// header("Content-Disposition: attachment; filename=export_".$vs_output_file_name.".".$vs_file_extension);
// header("Content-type: text/xml");
// $this->opo_response->addContent($va_buf[0], 'view');
// return;
// } else { // more than one record... create a ZIP file
// header("Content-Disposition: attachment; filename=export_".$vs_output_file_name.".zip");
// header("Content-type: application/zip");
// $o_zip = new ZipFile();
//
// $vn_i = 1;
// foreach($va_buf as $vs_buf) {
// $o_zip->addFile($vs_buf, $vs_export_target.'_'.$vn_i.'.'.$vs_file_extension);
// $vn_i++;
// }
// $this->opo_response->addContent($o_zip->output(ZIPFILE_RETURN_STRING), 'view');
// return;
// }
}
$vs_delimiter = "\t";
break;
}
header("Content-Disposition: attachment; filename=export_" . $vs_output_file_name . "." . $vs_file_extension);
header("Content-type: " . $vs_mimetype);
} else {
if (!($vs_filename = $va_settings['filename'])) {
$vs_filename = 'export_results.pdf';
}
if (!($vs_orientation = $va_settings['orientation'])) {
$vs_orientation = 'P';
}
if (!($vs_page_format = $va_settings['page_format'])) {
$vs_page_format = 'letter';
}
if (!($vs_language = $va_settings['language'])) {
$vs_language = 'en';
}
if (!($vs_font = $va_settings['font'])) {
$vs_font = 'dejavusans';
}
if (!($vb_unicode = $va_settings['unicode'])) {
$vb_unicode = true;
}
if (!($vs_enocoding = $va_settings['encoding'])) {
$vs_enocoding = 'UTF-8';
}
if (!($vs_margin_left = $va_settings['margin_left'])) {
$vs_margin_left = '5';
}
if (!($vs_margin_top = $va_settings['margin_top'])) {
$vs_margin_top = '5';
}
if (!($vs_margin_right = $va_settings['margin_right'])) {
$vs_margin_right = '5';
}
if (!($vs_margin_bottom = $va_settings['margin_bottom'])) {
$vs_margin_bottom = '8';
}
require_once __CA_LIB_DIR__ . "/core/Print/html2pdf/html2pdf.class.php";
try {
$vs_content = $this->render('Results/' . str_replace("<tablename>", $this->ops_tablename, $va_settings['script_to_render']));
$vo_html2pdf = new HTML2PDF($vs_orientation, $vs_page_format, $vs_language, $vb_unicode, $vs_enocoding, array($vs_margin_left, $vs_margin_top, $vs_margin_right, $vs_margin_bottom));
$vo_html2pdf->setDefaultFont($vs_font);
$vo_html2pdf->setTestIsImage(false);
$vo_html2pdf->WriteHTML($vs_content);
header("Content-Disposition: attachment; filename=" . $vs_filename);
header("Content-type: application/pdf");
$vo_html2pdf->Output($vs_filename);
$vb_printed_properly = true;
} catch (Exception $e) {
$vb_printed_properly = false;
$this->postError(3100, _t("Could not generate PDF"), "BaseEditorController->PrintSummary()");
}
}
// get display list
self::Index(null, null);
$va_display_list = $this->view->getVar('display_list');
$va_rows = array();
// output header
$va_row = array();
foreach ($va_display_list as $va_display_item) {
$va_row[] = $va_display_item['display'];
}
$va_rows[] = join($vs_delimiter, $va_row);
$po_result->seek(0);
$t_display = $this->view->getVar('t_display');
while ($po_result->nextHit()) {
$va_row = array();
foreach ($va_display_list as $vn_placement_id => $va_display_item) {
$vs_value = html_entity_decode($t_display->getDisplayValue($po_result, $vn_placement_id, array('convert_codes_to_display_text' => true, 'convertLineBreaks' => false)), ENT_QUOTES, 'UTF-8');
// quote values as required
if (preg_match("![^A-Za-z0-9 .;]+!", $vs_value)) {
$vs_value = '"' . str_replace('"', '""', $vs_value) . '"';
}
$va_row[] = $vs_value;
}
$va_rows[] = join($vs_delimiter, $va_row);
}
$this->opo_response->addContent(join("\n", $va_rows), 'view');
}
示例9: CreateSubHTML
/**
* création d'un sous HTML2PDF pour la gestion des tableaux imbriqués
*
* @param HTML2PDF futur sous HTML2PDF passé en référence pour création
* @param integer marge eventuelle de l'objet si simulation d'un TD
* @return null
*/
function CreateSubHTML(&$sub_html, $cellmargin = 0)
{
// initialisation du sous objet
$sub_html = new HTML2PDF($this->sens, $this->format, $this->langue, array($this->defaultLeft, $this->defaultTop, $this->defaultRight, $this->defaultBottom), true);
$sub_html->isSubPart = true;
$sub_html->setEncoding($this->encoding);
$sub_html->setTestTdInOnePage($this->testTDin1page);
$sub_html->setTestIsImage($this->testIsImage);
$sub_html->setDefaultFont($this->defaultFont);
$sub_html->style->css = $this->style->css;
$sub_html->style->css_keys = $this->style->css_keys;
$sub_html->style->table = $this->style->table;
$sub_html->style->value = $this->style->value;
$sub_html->style->value['text-align'] = 'left';
$sub_html->defLIST = $this->defLIST;
$sub_html->style->onlyLeft = true;
// initialisation de la largeur
if ($this->style->value['width']) {
$marge = $cellmargin * 2;
$marge += $this->style->value['padding']['l'] + $this->style->value['padding']['r'];
$marge += $this->style->value['border']['l']['width'] + $this->style->value['border']['r']['width'];
$marge = $sub_html->pdf->w - $this->style->value['width'] + $marge;
} else {
$marge = $this->margeLeft + $this->margeRight;
}
$sub_html->saveMargin(0, 0, $marge);
// initialisation des fontes
$sub_html->pdf->fonts =& $this->pdf->fonts;
$sub_html->pdf->FontFiles =& $this->pdf->FontFiles;
$sub_html->pdf->diffs =& $this->pdf->diffs;
// initialisation des positions et autre
$sub_html->page = $this->page;
$sub_html->maxX = 0;
$sub_html->maxY = 0;
$sub_html->maxH = 0;
$sub_html->pdf->setXY(0, 0);
$sub_html->style->FontSet();
}