Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

meteor-pdfjs

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

meteor-pdfjs

npm version of meteor-pdfjs

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

pdfjs

PDF rendering for your Meteor application (client only). This package use the Mozilla's PDF reader built with HTML5 and JavaScript

If you need server side PDF rendering, please use pdf.js Meteor package from Mitar: https://github.com/peerlibrary/meteor-pdf.js

Quick Start

  1. Install the Meteor package using mgp
  2. Example:
<!-- In your template -->
<canvas id="pdfcanvas"></canvas>
/* In your Template.xxx.rendered */
import PDFJS from 'meteor/geekho:pdfjs';

// Set worker URL to package assets
PDFJS.GlobalWorkerOptions.workerSrc = '/packages/geekho_pdfjs/build/pdf.worker.js';
// Create PDF
PDFJS.getDocument(url).promise.then(function getPdfHelloWorld(pdf) {
	// Fetch the first page
	pdf.getPage(1).then(function getPageHelloWorld(page) {
		var scale = 1;
		var viewport = page.getViewport({ scale });

		// Prepare canvas using PDF page dimensions
		var canvas = document.getElementById('pdfcanvas');
		var context = canvas.getContext('2d');
		canvas.height = viewport.height;
		canvas.width = viewport.width;

		// Render PDF page into canvas context
		page.render({canvasContext: context, viewport: viewport}).promise.then(function () {
			...
		});
	});
});

Documentation

You can find information about pdf.js lib:

License

MIT

FAQs

Package last updated on 17 Sep 2019

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc