You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

eleventy-plugin-pdfembed

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eleventy-plugin-pdfembed

This is an Eleventy plugin that creates a shortcode for Adobe's PDF Embed API.

latest
Source
npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
Source

Eleventy Plugin: PDFEmbed

This is an Eleventy plugin that creates a shortcode for Adobe's PDF Embed API. The PDF Embed API creates a web-based PDF viewer that gives you more control over the PDF experience in the browser compared to the built-in browser renderer. You can control the size, layout, and more using the API. (See the online demos for examples.)

In order to use this plugin, you must create a free set of credentials first.

Usage

To add the plugin to your Eleventy site, first install it:

npm i eleventy-plugin-pdfembed

Then add it to your .eleventy.js:

const pluginPDFEmbed = require('eleventy-plugin-pdfembed');

module.exports = (eleventyConfig) => {

	// more stuff here

	eleventyConfig.addPlugin(pluginPDFEmbed, {
		key: '<YOUR CREDENTIAL KEY>'
	});


}

Inside your templates, you can then use the shortcode like so:

{% pdfembed 'https://documentcloud.adobe.com/view-sdk-demo/PDFs/Bodea Brochure.pdf' %}

The plugin requires, at minimum, the URL to your PDF document. It supports two additional parameters now. The first is mode, which defines how the PDF is embedded on the page. See the online demo for examples. Valid values are:

  • FULL_WINDOW (default)
  • SIZED_CONTAINER
  • IN_LINE
  • LIGHT_BOX

For example:

{% pdfembed 'https://documentcloud.adobe.com/view-sdk-demo/PDFs/Bodea Brochure.pdf' 'LIGHT_BOX' %}

The third argument lets you customize the ID value used for the div tag. By default this is adobe-pdf-view, but you can set this to any valid ID:

<style>
#pdfdemo {
    width: 500px;
    height: 500px;
}
</style>

{% pdfembed 'https://documentcloud.adobe.com/view-sdk-demo/PDFs/Bodea Brochure.pdf' 'IN_LINE' 'pdfdemo' %}

History

Feb 2, 2023 (1.0.2) - updated the script tag to use the modern viewer.

Keywords

eleventy

FAQs

Package last updated on 10 Feb 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts