Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
pdf.php
1<?php
2
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 {
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}
getOption($name, $defaultValue=null)
Definition renderer.php:25