1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
pdf.php
См. документацию.
1<?php
2
3namespace Bitrix\Main\UI\Viewer\Renderer;
4
5class Pdf extends Renderer
6{
7 const WIDTH = 900;
8 const HEIGHT = 800;
9
10 const JS_TYPE_DOCUMENT = 'document';
11
12 public function getWidth()
13 {
14 return $this->getOption('width', self::WIDTH);
15 }
16
17 public function getHeight()
18 {
19 return $this->getOption('height', self::HEIGHT);
20 }
21
22 public static function getJsType()
23 {
24 return self::JS_TYPE_DOCUMENT;
25 }
26
27 public static function getAllowedContentTypes()
28 {
29 return [
30 'application/pdf',
31 ];
32 }
33
34 public function render()
35 {
36 global $APPLICATION;
37 ob_start();
38 $APPLICATION->IncludeComponent(
39 'bitrix:pdf.viewer',
40 '',
41 [
42 'TITLE' => $this->name,
43 'PATH' => $this->sourceUri,
44 'HEIGHT' => $this->getHeight(),
45 'WIDTH' => $this->getWidth(),
46 'sizeType' => $this->getOption('sizeType', 'absolute'),
47 ]
48 );
49
50 return ob_get_clean();
51 }
52
53 public function getData()
54 {
55 return [
56 'src' => $this->sourceUri,
57 ];
58 }
59}
global $APPLICATION
Определения include.php:80
const HEIGHT
Определения pdf.php:8
const JS_TYPE_DOCUMENT
Определения pdf.php:10
static getAllowedContentTypes()
Определения pdf.php:27
const WIDTH
Определения pdf.php:7
static getJsType()
Определения pdf.php:22
getOption($name, $defaultValue=null)
Определения renderer.php:25