PHP code example of steamulo / pdfjs-viewer-bundle

1. Go to this page and download the library: Download steamulo/pdfjs-viewer-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

steamulo / pdfjs-viewer-bundle example snippets


return $this->get('jjalvarezl_pdfjs_viewer.viewer_controller')->renderTestViewer();

$parameters = array(
        //Tell to the bundle that the pdf is outside the webroot
        'isPdfOutsideWebroot' => true,

        //Tell to the bundle where is the pdf. (absolute path for outside temporal folder pdf, just the <name>.pdf for inside temporal folder)
        'pdf' => '/home/jjalvarezl/Descargas/123.pdf',

        //Tell to the bundle that its necessary to delete pdf after render.
        'deletePdfInTmpAfterRenderized' => false,
    );

return $this->get('jjalvarezl_pdfjs_viewer.viewer_controller')->renderDefaultViewer($parameters);

$parameters = array(
        //Same parameters as defalt viewer.

        //pdf.js viewer options
        'showToolBar' => true,
        'showLeftToolbarButton' => true,
        'showSearchInDocumentButton' => true,
        'showPreviousPageButton' => true,
        'showPreviousPageButton' => true,
        'showFindPageInputText' => true,
        'showNumberOfPagesLabel' => true,
        'showZoomInButton'=> false,
        'showZoomOutButton'=> false,
        'showScaleSelectComboBox'=> false,
        'showPresentationModeButton'=> true,
        'showOpenFileButton'=> true,
        'showPrintButton'=> true,
        'showDownloadButton'=> true,
        'showViewBookmarkButton'=> true,
        'showToolsButton'=> true,
    );

return $this->get('jjalvarezl_pdfjs_viewer.viewer_controller')->renderCustomViewer($parameters);
 bash
$ php composer.phar 
 php

// config/bundles.php

return [
    // ...

    jjalvarezl\PDFjsViewerBundle\jjalvarezlPDFjsViewerBundle:class => ['all' => true],
];