PHPackages                             rexrana/pdfjs-viewer-shortcode - 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. rexrana/pdfjs-viewer-shortcode

ActiveWordpress-plugin[PDF &amp; Document Generation](/categories/documents)

rexrana/pdfjs-viewer-shortcode
==============================

Embed PDFs with the gorgeous PDF.js viewer

1.6.4(11mo ago)112GPL-3.0-or-laterJavaScriptPHP &gt;=7.1

Since Mar 25Pushed 11mo ago1 watchersCompare

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

READMEChangelog (6)Dependencies (1)Versions (16)Used By (0)

PDF.js Viewer Shortcode
=======================

[](#pdfjs-viewer-shortcode)

**Contributors:** [peterhebert](https://profiles.wordpress.org/peterhebert/), [mediaformat](https://profiles.wordpress.org/mediaformat/)
**Tags:** pdf, pdf.js, viewer, reader, embed, mozilla, shortcode
**Requires at least:** 3.0.1
**Tested up to:** 5.3.2
**Stable tag:** 1.6.5

Embed a beautiful PDF viewer into pages with a simple shortcode.

Description
-----------

[](#description)

Incorporate Mozilla's PDF.js viewer into your pages and posts with a simple shortcode. PDF.js is a javascript library for displaying pdf pages within browsers.

Features:

- Elegant speckled gray theme
- Customizable buttons
- Page navigation drawer
- Advanced search functionality
- Language support for all languages
- Protected PDF password entry
- Loading bar &amp; displays partially loaded PDF (great for huge PDFs!)
- Document outline
- Advanced zoom settings
- Easy to use editor media button that generates the shortcode for you
- Support for mobile devices

Shortcode Syntax:

```
[pdfjs-viewer file="http://www.website.com/test.pdf" width="600px" height="700px" fullscreen="true" download="true" print="true"]

```

Required parameters:

- file: direct url to pdf file

Optional parameters:

- width: width of the viewer (default: 100%) - takes any valid [CSS length value](https://www.w3.org/TR/css-values-4/#length-value)
- height: height of the viewer (default: 700px) - takes any valid [CSS length value](https://www.w3.org/TR/css-values-4/#length-value)
- fullscreen: true/false, displays fullscreen link above viewer (default: true)
- download: true/false, enables or disables download button (default: true)
- print: true/false, enables or disables print button (default: true)

Installation
------------

[](#installation)

Zip archive
===========

[](#zip-archive)

- Upload and expand the archive into your sites wp-content/plugins directory, or:

Composer
========

[](#composer)

Works best in a [Roots Bedrock](https://roots.io/bedrock/) stack

1. add GitHub repository to the `repositories` section of your composer.json

```
    "repositories": {
        "pdfjs-viewer-shortcode": {
            "type": "vcs",
            "url": "https://github.com/rexrana/pdfjs-viewer-shortcode.git"
        }
    },

```

2. Add dependency: `composer require rexrana/pdfjs-viewer-shortcode`

Screenshots
-----------

[](#screenshots)

Changelog
---------

[](#changelog)

### 1.6.4

[](#164)

- Fix media insertion button

### 1.6.3

[](#163)

- Updated dependency: Carbon Fields.

### 1.6.2

[](#162)

- Added Update URI plugin header to avoid overwriting / collisions with WordPress updater
- proper sanitzing of insert pdf button for classic editor.

### 1.6.1

[](#161)

- removed Carbon Fields plugin (only need as library)
- fixed Composer autoloading

### 1.6.0

[](#160)

- added gutenberg block via [Carbon Fields](https://docs.carbonfields.net/#/containers/gutenberg-blocks)

### 1.5.3

[](#153)

- fixed error in shortcode.php pdfjs\_viewer\_attributes() function where variable $attr\_html not instantiated.

### 1.5.2

[](#152)

- return instead of echo within shortcode function, fixing bug where it breaks out of container in WPBakery.

### 1.5.1

[](#151)

- Added wrapper div around shortcode output

### 1.5.0

[](#150)

- Added shortcode mapping for WPBakery Page Builder (Visual Composer)
- Integrate media library with insert dialog with WPBakery Page Builder

### 1.4.3

[](#143)

- better sanitization of html attributes for iframe
- more useful instructions for settings page
- regex to validate CSS dimensions for width and height
- added POT for gettext translation
- improved readme

### 1.4.2

[](#142)

- fix to javascript for classic editor "Insert PDF" button, avoiding double-escaping file URL.

### 1.4.1

[](#141)

- fix to javascript for classic editor "Insert PDF" button, updating shortcode parameters to their new names.

### 1.4.0

[](#140)

- Composer support
- updated shortcode functions with proper sanitization and escaping
- added plugin settings page for setting remote viewer URL
- split functions into seperate files in inc folder
- restructure file paths

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance51

Moderate activity, may be stable

Popularity5

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity62

Established project with proven stability

 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.

###  Release Activity

Cadence

Every ~189 days

Recently: every ~490 days

Total

13

Last Release

343d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ce13229b559cd881ade3d4eb1c17f12962dfa5a65606d7f7379ba93272e3eca2?d=identicon)[rexrana](/maintainers/rexrana)

---

Top Contributors

[![peterhebert](https://avatars.githubusercontent.com/u/3053120?v=4)](https://github.com/peterhebert "peterhebert (49 commits)")[![mediaformat](https://avatars.githubusercontent.com/u/2895351?v=4)](https://github.com/mediaformat "mediaformat (5 commits)")[![BenjaminLawson](https://avatars.githubusercontent.com/u/3166039?v=4)](https://github.com/BenjaminLawson "BenjaminLawson (2 commits)")

### Embed Badge

![Health badge](/badges/rexrana-pdfjs-viewer-shortcode/health.svg)

```
[![Health](https://phpackages.com/badges/rexrana-pdfjs-viewer-shortcode/health.svg)](https://phpackages.com/packages/rexrana-pdfjs-viewer-shortcode)
```

###  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)
