PdfiumRenderer plugin

Installation

  1. Add ImageResizer.Plugins.PdfiumRenderer.dll to the project or /bin.
  2. In the <plugins /> section, insert <add name="PdfiumRenderer" downloadNativeDependencies="true"/>

Via nuget

  1. Install-Package ImageResizer.Plugins.PdfiumRenderer
  2. In the <plugins /> section of Web.config, insert <add name="PdfiumRenderer" downloadNativeDependencies="true"/>

This plugin requires pdfium.dll to be present. Both 32-bit and 64-bit variants are supported.

There are two options to include these native Dlls:

  • Put either the 32-bit or 64-bit version of the pdfium DLL in the same directory as where the plugin is located;
  • In the same directory as where the plugin is located, create an "x86" directory with the 32-bit DLL and an "x64" directory with the 64-bit DLL. The PdfiumViewer library will then automatically pick the correct one.
  • Specify downloadNativeDependencies=true during installation.

The pdfium DLLs can be downloaded from:

https://github.com/pvginkel/PdfiumViewer/raw/master/Libraries/Pdfium/x86/pdfium.dll (32-bit) https://github.com/pvginkel/PdfiumViewer/raw/master/Libraries/Pdfium/x64/pdfium.dll (64-bit)

Parameters

Given a URL to a pdf on the same server, add ?page=1&width=600

  • width and height control the rendered page size.
  • page - determines which page is rendered.
  • annotation=true - renders annotations.
  • lcd=true -optimizes rendered text for LCD displays.
  • grayscale=true - Renders in grayscale.
  • halftone=true - Forces halftone rendering.
  • print=true - Optimizes for printing.
  • transparent=true - Enables transparency.

This plugin (PdfiumRenderer plugin) is part of the Essential edition

Where is the plugins section?

The <plugins> section is located in Web.config, and is nested inside the <resizer> element, which is nested inside <configuration>. For examples, see this sample Web.config file.

Where can I find the dll?

We prefer that you install via NuGet, but you can also find the plugin DLL files in the /dlls/release folder of your download.

How do I typically install a plugin via Web.Config?

  1. In Visual Studio, right click on your project and choose "Add reference". Browse to the plugin DLL and click "OK".
  2. In the <plugins> section of Web.config, insert <add name="PluginName" />
  3. Look at the plugin documentation to see what configuration options (if any) are available.

How do I typically install a plugin via code?