• Модуль: documentgenerator
  • Путь к файлу: ~/bitrix/modules/documentgenerator/lib/controller/document.php
  • Класс: BitrixDocumentGeneratorControllerDocument
  • Вызов: Document::showPdfAction
public function showPdfAction(BitrixDocumentGeneratorDocument $document, $print = 'y', $pdfUrl = null, $width = 700, $height = 900, CRestServer $restServer = null)
{
	$response = new HttpResponse();
	if($document->PDF_ID > 0)
	{
		global $APPLICATION;
		ob_start();
		$APPLICATION->IncludeComponent(
			'bitrix:pdf.viewer',
			'',
			[
				'PATH' => $pdfUrl ? $pdfUrl : $document->getPdfUrl(),
				'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
	{
		Loc::loadLanguageFile(__FILE__);
		$this->errorCollection[] = new Error(Loc::getMessage('DOCGEN_CONTROLLER_DOCUMENT_NO_PDF'));
	}
	if($print === 'y')
	{
		return $response;
	}
	else
	{
		return [
			'html' => $response->getContent(),
		];
	}
}