New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

dom-to-pdf

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dom-to-pdf - npm Package Compare versions

Comparing version 0.3.0 to 0.3.1

40

index.js

@@ -89,4 +89,16 @@ let _cloneNode;

let compression = 'NONE';
let scale;
let opts;
let offsetHeight;
let offsetWidth;
let scaleObj;
let style;
const transformOrigin = 'top left';
const pdfOptions = {
orientation: 'p',
unit: 'pt',
format: 'a4'
};
({filename, excludeClassNames = [], excludeTagNames = ['button', 'input', 'select'], overrideWidth, proxyUrl, compression} = options);
({filename, excludeClassNames = [], excludeTagNames = ['button', 'input', 'select'], overrideWidth, proxyUrl, compression, scale} = options);

@@ -201,6 +213,26 @@ overlayCSS = {

return domToImage.toCanvas(container, {
opts = {
filter: filterFn,
proxy: proxyUrl
}).then(canvas => {
};
if (scale) {
offsetWidth = container.offsetWidth;
offsetHeight = container.offsetHeight;
style = {
transform: 'scale(' + scale + ')',
transformOrigin: transformOrigin,
width: offsetWidth + 'px',
height: offsetHeight + 'px'
};
scaleObj = {
width: offsetWidth * scale,
height: offsetHeight * scale,
quality: 1,
style: style
};
opts = Object.assign(opts, scaleObj);
}
return domToImage.toCanvas(container, opts).then(canvas => {
let h;

@@ -219,3 +251,3 @@ let imgData;

// Initialize the PDF.
pdf = new jsPDF('p', 'pt', 'a4');
pdf = new jsPDF(pdfOptions);
// Calculate the number of pages.

@@ -222,0 +254,0 @@ pxFullHeight = canvas.height;

2

package.json
{
"name": "dom-to-pdf",
"version": "0.3.0",
"version": "0.3.1",
"description": "Generates a printable paginated pdf from DOM node using HTML5 canvas and svg.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -31,2 +31,3 @@ # dom-to-pdf

* `compression` - string, compression of the generated image, can have the values 'NONE', 'FAST', 'MEDIUM' and 'SLOW'. (default is 'NONE')
* `scale` - number, increases an image's size before exporting to improve the image quality

@@ -33,0 +34,0 @@

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