- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/lib/controller/documentgenerator/document.php
- Класс: Bitrix\Crm\Controller\DocumentGenerator\Document
- Вызов: Document::showPdfAction
public function showPdfAction(\Bitrix\DocumentGenerator\Document $document, $print = 'n', $width = 700, $height = 900)
{
$response = new HttpResponse();
if($document->PDF_ID > 0)
{
global $APPLICATION;
ob_start();
$APPLICATION->IncludeComponent(
'bitrix:pdf.viewer',
'',
[
'PATH' => $this->getDocumentFileLink($document->ID, 'getPdf', $document->getUpdateTime()->getTimestamp()),
'IFRAME' => ($print === 'y' ? 'Y' : 'N'),
'PRINT' => ($print === 'y' ? 'Y' : 'N'),
'TITLE' => $document->getTitle(),
'WIDTH' => $width,
'HEIGHT' => $height,
]
);
$response->setContent(ob_get_contents());
ob_end_clean();
}
else
{
$this->errorCollection[] = new Error('No pdf for this document');
}
if($print === 'y')
{
return $response;
}
else
{
return [
'html' => $response->getContent(),
];
}
}