WP Manifestindependent plugin directory
manifest / media / pdf-renderer

PDF-Renderer WP Registry grade A. No security issues foundWP RegistryNo security issues foundOpen the reportA

Convert PDF Files to images before upload in WP Media Library.

★ 4stars
10release downloads
1composer installs
0.2.0latest · 1 year ago

Install

Download pdf-renderer.zip From the 0.2.0 release on GitHub, Dec 31, 2024

Upload it under Plugins → Add New Plugin → Upload Plugin, then activate.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/mcguffin/pdf-renderer/releases/download/0.2.0/pdf-renderer.zip

On Packagist as mcguffin/pdf-renderer:

composer require mcguffin/pdf-renderer
Updates itself. It ships its own updater (Update URI header), so new versions appear under Dashboard → Updates.

Convert PDF Files to Images in your browser when dropped into the media library.

Includes Mozilla pdf.js for browser pdf rendering.

Upload Dialog PDF-Contents: cc-by Creative Commons

Installation

Production

  • Head over to releases
  • Download 'pdf-renderer.zip'
  • Upload and activate it like any other WordPress plugin
  • AutoUpdate will run as long as the plugin is active

Using composer

composer require mcguffin/pdf-renderer

For Development

  • cd into your plugin directory
  • $ git clone git@github.com:mcguffin/pdf-renderer.git
  • $ cd pdf-renderer
  • $ npm install
  • $ npm run dev

Plugin API

Filter pdf_renderer_image_width

Use this to overrule width of generated images. Uses the largest image width known to WP by default. (e.g. the Large size from Settings > Media).

Example:

add_filter( 'pdf_renderer_image_width', function( $width ) {
    // never underestimate a good integer.
    return 12345;
});

Filter pdf_renderer_image_type

Type of generated images. Possible values are image/png and image/jpeg. default is image/png.
To override the JPEG-Quality you can use the WP Core filter jpeg_quality. The string pdf_renderer is passed as a second argument to apply_filters().

Example:

// we want jpeg ...
add_filter( 'pdf_renderer_image_type', function( $type ) {
    return 'image/jpeg';
});
// ... and a specific treatment for PDFs.
add_filter( 'jpeg_quality', function( $quality, $context = '' ) {
    if ( 'pdf_renderer' === $context ) {
        // Everybody loves artifacts.
        return 1;
    }
    return $quality;
}, 10, 2);

Development

npm scripts:

  • npm run audit: Run phpcs audit
  • npm run build: Build css and js from sources
  • npm run dev: Watch css and js source dirs
  • npm run dashicons: Generate dashicons scss variables from source
  • npm run i18n: generate .pot file
  • npm run rollback: remove last commit (local and remote – use with caution!)
  • npm run test: run unit tests against PHP 7.4 and 8.3
  • npm run test:edge: run unit tests against PHP 8.3 only
  • npm run test:legacy: run unit tests against PHP 7.4 only

Testing

Unit Tests

Unit tests are run in wordpress/env, which is basically a docker container. Docker Desktop is required.

Unit tests are run against PHP 7.4 (legacy) and 8.3 (edge).

Run them all:

npm run test

Run edge tests only:

npm run test:edge

Configure edge test and run something in wp-cli in the docker container:

npm run test:set-edge
npm run test:reset-env
wp-env run cli wp core version
> 6.7.1

Releases

3 releases. Each count is every asset in that release; expand a row for the breakdown.

Tag
Published
Assets
Downloads
0.2.0 latest
Dec 31, 2024 1 year ago
pdf-renderer.zip
6
Aug 26, 2021 5 years ago
pdf-renderer.zip
4
Aug 2, 2019 7 years ago
tag only
—
A grade

Security

PDF-Renderer 0.2.0 · audited by WP Registry

No security issues found.

Audited release
0.2.0
Findings
none
Worst severity
—
Content hash
be407b0e53ea57095b42a8d8…

WP Registry hashes the installable build and reports on that exact bytes-for-bytes copy. Embargoed findings are withheld until they are disclosed, so a clean verdict means nothing public is outstanding. WP Manifest does not audit code itself.