本文整理汇总了PHP中Builder::buildDocument方法的典型用法代码示例。如果您正苦于以下问题:PHP Builder::buildDocument方法的具体用法?PHP Builder::buildDocument怎么用?PHP Builder::buildDocument使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Builder
的用法示例。
在下文中一共展示了Builder::buildDocument方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveDocument
public static function saveDocument($dataObject, $path, $fileName)
{
if (file_exists($path . $fileName)) {
unlink($path . $fileName);
}
try {
/*Document*/
$data = Builder::buildDocument($dataObject);
if ($data == null) {
throw new Exception("Can't build document based on " . get_class($dataObject));
}
if ($data->metadata != null) {
/*Property*/
$pageSizeProperty = $data->metadata->getPropertyByName(Property::$PAGE_FORMAT);
if ($pageSizeProperty != null) {
if ($pageSizeProperty->value == Property::$PAGE_FORMAT_A4) {
$data->width = Document::$pageFormats['a4'][0];
$data->height = Document::$pageFormats['a4'][1];
} else {
if ($pageSizeProperty->value == Property::$PAGE_FORMAT_A4_ALBUM) {
$data->width = Document::$pageFormats['a4'][1];
$data->height = Document::$pageFormats['a4'][0];
}
}
}
}
$pdfwr = null;
Log::log(LoggingConstants::MYDEBUG, "PDF: create file");
if (!is_numeric($data->width)) {
$pdfwr = new PDF("P", "pt", $data->width);
} else {
$pdfwr = new PDF("P", "pt", array($data->width, $data->height));
}
$pdfwr->SetAutoPageBreak(false);
//, abs($data->marginBottom));
$data->write($pdfwr);
Log::log(LoggingConstants::MYDEBUG, "WRITE FINISHED");
$pdfwr->Output($path . $fileName, "F");
} catch (Exception $exception) {
Log::log(LoggingConstants::MYDEBUG, $exception->getMessage() . "\n" . $exception->getTrace());
throw $exception;
}
// fwrite($fileHandler, $buf);
// fclose($fileHandler);
}
示例2: buildOnMethod
public function buildOnMethod($value)
{
return Builder::buildDocument(DataUtils::getValue($value));
}