PHPackages                             xililo/yii2-pdfjs - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [PDF &amp; Document Generation](/categories/documents)
4. /
5. xililo/yii2-pdfjs

ActiveLibrary[PDF &amp; Document Generation](/categories/documents)

xililo/yii2-pdfjs
=================

Previewer PDF File with PDF.js for Yii2 with CORS unrestricted

06JavaScript

Since Jan 19Pushed 1y agoCompare

[ Source](https://github.com/xililo/yii2-pdfjs)[ Packagist](https://packagist.org/packages/xililo/yii2-pdfjs)[ RSS](/packages/xililo-yii2-pdfjs/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Yii2 PDF.js
===========

[](#yii2-pdfjs)

Previewer PDF File with PDF.js for Yii2

[![Latest Stable Version](https://camo.githubusercontent.com/6286f1bde9ef93274b3f82425057f68f1d9915bf22dacb4b2b866c5116523dd3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f78696c696c6f2f796969322d7064666a733f6c6162656c3d737461626c65)](https://packagist.org/packages/xililo/yii2-pdfjs)[![Total Downloads](https://camo.githubusercontent.com/fb347834d5aad401ba361b3d3b75a2fe2cb5be5df671958cc9436204abaeeb33/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f78696c696c6f2f796969322d7064666a73)](https://packagist.org/packages/xililo/yii2-pdfjs)[![Latest Stable Release Date](https://camo.githubusercontent.com/05bf5f74fc3a1830200c5058edaf2aa3f644b85a963e7d560dc7403f256f9b65/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652d646174652f78696c696c6f2f796969322d7064666a73)](https://github.com/xililo/yii2-pdfjs)[![Quality Score](https://camo.githubusercontent.com/6e24966818fe51c83f83ce0ead019201af94118a69142eea783b359868688b6c/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f7175616c6974792f672f78696c696c6f2f796969322d7064666a73)](https://scrutinizer-ci.com/g/xililo/yii2-pdfjs)[![Build Status](https://camo.githubusercontent.com/064927adced6816857f73ed6ab2192163b99cac583fc2b952921430d811561e8/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f636f6d2f78696c696c6f2f796969322d7064666a73)](https://app.travis-ci.com/xililo/yii2-pdfjs)[![License](https://camo.githubusercontent.com/8e2371626bdedb7ace8b19a0f01990791cee09ccefd0daf02dfb319d811fc62d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f78696c696c6f2f796969322d7064666a73)](https://github.com/xililo/yii2-pdfjs)[![PHP Version Require](https://camo.githubusercontent.com/d10ab4ac09dd62dba2cfdf1d2922e2054f6c6a65e22ad961fdb0efe7860465df/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f78696c696c6f2f796969322d7064666a732f7068703f636f6c6f723d366637336136)](https://packagist.org/packages/xililo/yii2-pdfjs)

> Yii2 PDF.js uses [PDF.js](https://mozilla.github.io/pdf.js/)
>  Demo:

Table of Contents
-----------------

[](#table-of-contents)

- [Yii2 PDF.js](#yii2-pdfjs)
    - [Table of Contents](#table-of-contents)
    - [Instalation](#instalation)
    - [Dependencies](#dependencies)
    - [Usage](#usage)
        - [Setup Module](#setup-module)
        - [Views](#views)
            - [Basic Usage](#basic-usage)
            - [Direct Url with Full Toolbar Section](#direct-url-with-full-toolbar-section)
            - [Custom Attribute](#custom-attribute)
            - [Disable Toolbar Section](#disable-toolbar-section)

Instalation
-----------

[](#instalation)

Package is available on [Packagist](https://packagist.org/packages/xililo/yii2-pdfjs), you can install it using [Composer](https://getcomposer.org).

```
composer require xililo/yii2-pdfjs 'dev-master'
```

or add to the require section of your `composer.json` file.

```
'xililo/yii2-pdfjs': 'dev-master'
```

Dependencies
------------

[](#dependencies)

- PHP 7.2+
- [yiisoft/yii2](https://github.com/yiisoft/yii2)

Usage
-----

[](#usage)

### Setup Module

[](#setup-module)

```
...
'modules'=>[
  'pdfjs' => [
       'class' => \xililo\pdfjs\Module::class,
   ],
],
...
```

### Views

[](#views)

#### Basic Usage

[](#basic-usage)

```
echo \xililo\pdfjs\PdfJs::widget([
    'url' => '@web/uploads/dummy.pdf',
]);
```

#### Direct Url with Full Toolbar Section

[](#direct-url-with-full-toolbar-section)

```
echo Url::to(["/pdfjs", 'file' => Url::to('@web/uploads/dummy.pdf', true)], true);
```

#### Custom Attribute

[](#custom-attribute)

```
echo \xililo\pdfjs\PdfJs::widget([
    'url' => '@web/uploads/dummy.pdf',
    'options' => [
        'style' => [
            'width' => '100%',
            'height' => '500px',
        ],
    ],
]);
```

#### Disable Toolbar Section

[](#disable-toolbar-section)

```
echo \xililo\pdfjs\PdfJs::widget([
    'url' => '@web/uploads/dummy.pdf',
    'sections' => [
        'toolbarContainer' => false,
    ],
]);
```

###  Health Score

15

—

LowBetter than 3% of packages

Maintenance32

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity16

Early-stage or recently created project

 Bus Factor1

Top contributor holds 87.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/7f38178a9564b1d087bf5e18363ef720bdf4c80229e04a6a24e0cff104dbd5ac?d=identicon)[xililo](/maintainers/xililo)

---

Top Contributors

[![wanforge](https://avatars.githubusercontent.com/u/16300077?v=4)](https://github.com/wanforge "wanforge (28 commits)")[![xililo](https://avatars.githubusercontent.com/u/64233070?v=4)](https://github.com/xililo "xililo (4 commits)")

### Embed Badge

![Health badge](/badges/xililo-yii2-pdfjs/health.svg)

```
[![Health](https://phpackages.com/badges/xililo-yii2-pdfjs/health.svg)](https://phpackages.com/packages/xililo-yii2-pdfjs)
```

###  Alternatives

[spatie/browsershot

Convert a webpage to an image or pdf using headless Chrome

5.2k32.1M102](/packages/spatie-browsershot)[barryvdh/laravel-snappy

Snappy PDF/Image for Laravel

2.8k24.8M48](/packages/barryvdh-laravel-snappy)[openspout/openspout

PHP Library to read and write spreadsheet files (CSV, XLSX and ODS), in a fast and scalable way

1.2k57.6M131](/packages/openspout-openspout)[keboola/csv

Keboola CSV reader and writer

1451.8M21](/packages/keboola-csv)[setasign/tfpdf

This class is a modified version of FPDF that adds UTF-8 support. The latest version is based on FPDF 1.85.

426.1M30](/packages/setasign-tfpdf)[aspera/xlsx-reader

Spreadsheet reader library for XLSX files

52742.2k5](/packages/aspera-xlsx-reader)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
