\Kendo\UI\PDFViewer

A PHP wrapper for Kendo UI PDFViewer.

Inherits from \Kendo\UI\Widget.

Usage

To use PDFViewer in a PHP page instantiate a new instance, configure it via the available configuration methods and output it by echo-ing the result of the render method.

Using Kendo PDFViewer

<?php
// Create a new instance of PDFViewer and specify its id
$pDFViewer = new \Kendo\UI\PDFViewer('PDFViewer');

// Configure it
$pDFViewer->height(1)

// Output it

echo $pDFViewer->render();
?>

Methods

defaultPageSize

Specifies the default page size if no PDF is displayed in the PDFViewer. The page size will shrink to fit the viewer dimensions.

Returns

\Kendo\UI\PDFViewer

Parameters

$value \Kendo\UI\PDFViewerDefaultPageSize|array

Example - using \Kendo\UI\PDFViewerDefaultPageSize

<?php
$pDFViewer = new \Kendo\UI\PDFViewer('PDFViewer');
$defaultPageSize = new \Kendo\UI\PDFViewerDefaultPageSize();
$height = 1;
$defaultPageSize->height($height);
$pDFViewer->defaultPageSize($defaultPageSize);
?>

Example - using array

<?php
$pDFViewer = new \Kendo\UI\PDFViewer('PDFViewer');
$height = 1;
$pDFViewer->defaultPageSize(array('height' => $height));
?>

document

The client-side global variable or function to provide the JSON data for the PDF document.

Returns

\Kendo\UI\PDFViewer

Parameters

$value \Kendo\JavaScriptFunction

Example

<?php
$pDFViewer = new \Kendo\UI\PDFViewer('PDFViewer');
$pDFViewer->document(new \Kendo\JavaScriptFunction('function() { }'));
?>

dplProcessing

Specifies the DPL configuration options.

Returns

\Kendo\UI\PDFViewer

Parameters

$value \Kendo\UI\PDFViewerDplProcessing|array

Example - using \Kendo\UI\PDFViewerDplProcessing

<?php
$pDFViewer = new \Kendo\UI\PDFViewer('PDFViewer');
$dplProcessing = new \Kendo\UI\PDFViewerDplProcessing();
$loadOnDemand = true;
$dplProcessing->loadOnDemand($loadOnDemand);
$pDFViewer->dplProcessing($dplProcessing);
?>

Example - using array

<?php
$pDFViewer = new \Kendo\UI\PDFViewer('PDFViewer');
$loadOnDemand = true;
$pDFViewer->dplProcessing(array('loadOnDemand' => $loadOnDemand));
?>

error

Fires when an error is encountered. By default, a dialog is shown with error message. The dialog will not be shown if the event is prevented. For additional information check the error event documentation.

Returns

\Kendo\UI\PDFViewer

Parameters

$value string|\Kendo\JavaScriptFunction

Example - using string which defines a JavaScript function

<?php
$pDFViewer = new \Kendo\UI\PDFViewer('PDFViewer');
$pDFViewer->error('function(e) { }');
?>

Example - using string which defines a JavaScript name

<script>
    function onError(e) {
        // handle the error event.
    }
</script>
<?php
$pDFViewer = new \Kendo\UI\PDFViewer('PDFViewer');
$pDFViewer->error('onError');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$pDFViewer = new \Kendo\UI\PDFViewer('PDFViewer');
$pDFViewer->error(new \Kendo\JavaScriptFunction('function(e) { }'));
?>

height

The height of the PDFViewer.

Returns

\Kendo\UI\PDFViewer

Parameters

$value float|string

Example - using float

<?php
$pDFViewer = new \Kendo\UI\PDFViewer('PDFViewer');
$pDFViewer->height(1);
?>

Example - using string

<?php
$pDFViewer = new \Kendo\UI\PDFViewer('PDFViewer');
$pDFViewer->height('value');
?>

messages

Specifies the localization messages of the PDFViewer.

Returns

\Kendo\UI\PDFViewer

Parameters

$value \Kendo\UI\PDFViewerMessages|array

Example - using \Kendo\UI\PDFViewerMessages

<?php
$pDFViewer = new \Kendo\UI\PDFViewer('PDFViewer');
$messages = new \Kendo\UI\PDFViewerMessages();
$defaultFileName = 'value';
$messages->defaultFileName($defaultFileName);
$pDFViewer->messages($messages);
?>

Example - using array

<?php
$pDFViewer = new \Kendo\UI\PDFViewer('PDFViewer');
$defaultFileName = 'value';
$pDFViewer->messages(array('defaultFileName' => $defaultFileName));
?>

open

Fires when a PDF is opened in the viewer. For additional information check the open event documentation.

Returns

\Kendo\UI\PDFViewer

Parameters

$value string|\Kendo\JavaScriptFunction

Example - using string which defines a JavaScript function

<?php
$pDFViewer = new \Kendo\UI\PDFViewer('PDFViewer');
$pDFViewer->open('function(e) { }');
?>

Example - using string which defines a JavaScript name

<script>
    function onOpen(e) {
        // handle the open event.
    }
</script>
<?php
$pDFViewer = new \Kendo\UI\PDFViewer('PDFViewer');
$pDFViewer->open('onOpen');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$pDFViewer = new \Kendo\UI\PDFViewer('PDFViewer');
$pDFViewer->open(new \Kendo\JavaScriptFunction('function(e) { }'));
?>

page

The selected page number in the viewer.

Returns

\Kendo\UI\PDFViewer

Parameters

$value float

Example

<?php
$pDFViewer = new \Kendo\UI\PDFViewer('PDFViewer');
$pDFViewer->page(1);
?>

pdfjsProcessing

Specifies the PDF.JS configuration options. Including pdfjs is mandatory.

Returns

\Kendo\UI\PDFViewer

Parameters

$value \Kendo\UI\PDFViewerPdfjsProcessing|array

Example - using \Kendo\UI\PDFViewerPdfjsProcessing

<?php
$pDFViewer = new \Kendo\UI\PDFViewer('PDFViewer');
$pdfjsProcessing = new \Kendo\UI\PDFViewerPdfjsProcessing();
$file = 'value';
$pdfjsProcessing->file($file);
$pDFViewer->pdfjsProcessing($pdfjsProcessing);
?>

Example - using array

<?php
$pDFViewer = new \Kendo\UI\PDFViewer('PDFViewer');
$file = 'value';
$pDFViewer->pdfjsProcessing(array('file' => $file));
?>

renderEvent

Fires when a page is rendered For additional information check the render event documentation.

Returns

\Kendo\UI\PDFViewer

Parameters

$value string|\Kendo\JavaScriptFunction

Example - using string which defines a JavaScript function

<?php
$pDFViewer = new \Kendo\UI\PDFViewer('PDFViewer');
$pDFViewer->renderEvent('function(e) { }');
?>

Example - using string which defines a JavaScript name

<script>
    function onRender(e) {
        // handle the render event.
    }
</script>
<?php
$pDFViewer = new \Kendo\UI\PDFViewer('PDFViewer');
$pDFViewer->renderEvent('onRender');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$pDFViewer = new \Kendo\UI\PDFViewer('PDFViewer');
$pDFViewer->renderEvent(new \Kendo\JavaScriptFunction('function(e) { }'));
?>

toolbar

Toolbar option accepts a Boolean value which indicates if the toolbar will be displayed or an Object with items. Inherits Kendo UI Toolbar.

Returns

\Kendo\UI\PDFViewer

Parameters

$value boolean|\Kendo\UI\PDFViewerToolbar|array

Example - using boolean

<?php
$pDFViewer = new \Kendo\UI\PDFViewer('PDFViewer');
$pDFViewer->toolbar(true);
?>

Example - using \Kendo\UI\PDFViewerToolbar

<?php
$pDFViewer = new \Kendo\UI\PDFViewer('PDFViewer');
$toolbar = new \Kendo\UI\PDFViewerToolbar();
$items = new \Kendo\UI\PDFViewerToolbarItems();
$toolbar->items($items);
$pDFViewer->toolbar($toolbar);
?>

Example - using array

<?php
$pDFViewer = new \Kendo\UI\PDFViewer('PDFViewer');
$items = new \Kendo\UI\PDFViewerToolbarItems();
$pDFViewer->toolbar(array('items' => $items));
?>

view

Defines the page surface options. This setting is available only for DPL Processing. The page render a drawing Surface and all of its configuration options could be defined.

Returns

\Kendo\UI\PDFViewer

Parameters

$value \Kendo\UI\PDFViewerView|array

Example - using \Kendo\UI\PDFViewerView

<?php
$pDFViewer = new \Kendo\UI\PDFViewer('PDFViewer');
$view = new \Kendo\UI\PDFViewerView();
$type = 'value';
$view->type($type);
$pDFViewer->view($view);
?>

Example - using array

<?php
$pDFViewer = new \Kendo\UI\PDFViewer('PDFViewer');
$type = 'value';
$pDFViewer->view(array('type' => $type));
?>

width

The width of the PDFViewer.

Returns

\Kendo\UI\PDFViewer

Parameters

$value float|string

Example - using float

<?php
$pDFViewer = new \Kendo\UI\PDFViewer('PDFViewer');
$pDFViewer->width(1);
?>

Example - using string

<?php
$pDFViewer = new \Kendo\UI\PDFViewer('PDFViewer');
$pDFViewer->width('value');
?>
In this article
Not finding the help you need?