定制 rexrana/pdfjs-viewer-shortcode 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

rexrana/pdfjs-viewer-shortcode

Composer 安装命令:

composer require rexrana/pdfjs-viewer-shortcode

包简介

Embed PDFs with the gorgeous PDF.js viewer

README 文档

README

Contributors: peterhebert, 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

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 & 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
  • height: height of the viewer (default: 700px) - takes any valid CSS 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

Zip archive

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

Composer

Works best in a Roots 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"
        }
    },
  1. Add dependency: composer require rexrana/pdfjs-viewer-shortcode

Screenshots

Changelog

1.6.4

  • Fix media insertion button

1.6.3

  • Updated dependency: Carbon Fields.

1.6.2

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

1.6.1

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

1.6.0

1.5.3

  • fixed error in shortcode.php pdfjs_viewer_attributes() function where variable $attr_html not instantiated.

1.5.2

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

1.5.1

  • Added wrapper div around shortcode output

1.5.0

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

1.4.3

  • 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

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

1.4.1

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

1.4.0

  • 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

rexrana/pdfjs-viewer-shortcode 适用场景与选型建议

rexrana/pdfjs-viewer-shortcode 是一款 基于 JavaScript 开发的 Composer 扩展包,目前已累计 1 次下载、GitHub Stars 达 1, 最近一次更新时间为 2025 年 06 月 09 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 rexrana/pdfjs-viewer-shortcode 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 rexrana/pdfjs-viewer-shortcode 我们能提供哪些服务?
定制开发 / 二次开发

基于 rexrana/pdfjs-viewer-shortcode 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 1
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 22
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 12
  • 开发语言: JavaScript

其他信息

  • 授权协议: GPL-3.0-or-later
  • 更新时间: 2025-06-09