php - 无法在 sugarcrm 8 中生成 pdf
问题描述
我一直在尝试使用此处链接中文档中的示例代码在 Sugarcrm 中生成示例 pdf 文件
并尝试通过此 url 访问它:
http://sugarpro8.local.com/index.php?module=Meetings&action=sugarpdf&sugarpdf=clientpdf
这是源代码:
<?php
require_once('include/Sugarpdf/Sugarpdf.php');
class clientpdf extends Sugarpdf
{
/**
* Override
*/
function process(){
$this->preDisplay();
$this->display();
$this->buildFileName();
}
/**
* Custom header
*/
public function Header()
{
$this->SetFont(PDF_FONT_NAME_MAIN, 'B', 16);
$this->MultiCell(0, 0, 'TCPDF Header',0,'C');
$this->drawLine();
}
/**
* Custom header
*/
public function Footer()
{
$this->SetFont(PDF_FONT_NAME_MAIN, '', 8);
$this->MultiCell(0,0,'TCPDF Footer', 0, 'C');
}
/**
* Predisplay content
*/
function preDisplay()
{
//Adds a predisplay page
$this->AddPage();
$this->SetFont(PDF_FONT_NAME_MAIN,'',PDF_FONT_SIZE_MAIN);
$this->Ln();
$this->MultiCell(0,0,'Predisplay Content',0,'C');
}
/**
* Main content
*/
function display()
{
//add a display page
$this->AddPage();
$this->SetFont(PDF_FONT_NAME_MAIN,'',PDF_FONT_SIZE_MAIN);
$this->Ln();
$this->MultiCell(0,0,'Display Content',0,'C');
}
/**
* Build filename
*/
function buildFileName()
{
$this->fileName = 'example.pdf';
}
/**
* This method draw an horizontal line with a specific style.
*/
protected function drawLine()
{
$this->SetLineStyle(array('width' => 0.85 / $this->getScaleFactor(), 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(220, 220, 220)));
$this->MultiCell(0, 0, '', 'T', 0, 'C');
}
}
这是错误消息的屏幕截图:
我的自定义 pdf 文件也在 /custom/modules/Meetings/sugarpdf/sugarpdf.clientpdf.php 的路径中
我在这里做错了什么?希望一些天才编码员知道答案。
解决方案
推荐阅读
- google-bigquery - 用于检查整个表的空值的 Bigquery SQL 函数
- mongodb - 如何使用“嵌套查询”从 MongoDB 集合返回文档?
- sql - 在 SSIS 中将 varchar 数据类型转换为日期时间
- java - quarkus 中基于 XML 的休息服务
- applescript - 使用 applescript 的非递归文件夹操作
- string - Lua 如何重新格式化日期?
- javascript - 屏蔽信用卡号码并显示它以正确登录的人没有显示
- c++ - 如何使用 CMake 变量选择要包含在 ac 程序中的头文件
- javascript - JavaScript:为什么这个 Promise 没有返回值?
- java - 三个线程。T1 打印 1,4,7.. 消息序列 T2 打印 2,5,8.. 和 T3 打印 3,6,9.. 我如何同步这三个以打印 1-15 消息序列