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

html-to-pdfmake

Package Overview
Dependencies
Maintainers
1
Versions
110
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

html-to-pdfmake - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

_config.yml

6

example.js

@@ -35,3 +35,3 @@ var pdfMake = require("pdfmake/build/pdfmake");

<li>With a sub sub unordered list:
<ul>
<ul style="background-color:yellow">
<li>Sub Sub First item</li>

@@ -109,2 +109,6 @@ <li>Sub Sub Second item</li>

</table>
<div style="margin-top:20px">
An image: <img width="54" style="height:70px" src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEBLAEsAAD/7QPQUGhvdG9zaG9wIDMuMAA4QklNA+kKUHJpbnQgSW5mbwAAAAB4AAMAAABIAEgAAAAAAtgCKP/h/+IC+QJGA0cFKAP8AAIAAABIAEgAAAAAAtgCKAABAAAAZAAAAAEAAwMDAAAAAScPAAEAAQAAAAAAAAAAAAAAAGAIABkBkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOEJJTQPtClJlc29sdXRpb24AAAAAEAEsAAAAAQABASwAAAABAAE4QklNBA0YRlggR2xvYmFsIExpZ2h0aW5nIEFuZ2xlAAAAAAQAAAAeOEJJTQQZEkZYIEdsb2JhbCBBbHRpdHVkZQAAAAAEAAAAHjhCSU0D8wtQcmludCBGbGFncwAAAAkAAAAAAAAAAAEAOEJJTQQKDkNvcHlyaWdodCBGbGFnAAAAAAEAADhCSU0nEBRKYXBhbmVzZSBQcmludCBGbGFncwAAAAAKAAEAAAAAAAAAAjhCSU0D9RdDb2xvciBIYWxmdG9uZSBTZXR0aW5ncwAAAEgAL2ZmAAEAbGZmAAYAAAAAAAEAL2ZmAAEAoZmaAAYAAAAAAAEAMgAAAAEAWgAAAAYAAAAAAAEANQAAAAEALQAAAAYAAAAAAAE4QklNA/gXQ29sb3IgVHJhbnNmZXIgU2V0dGluZ3MAAABwAAD/////////////////////////////A+gAAAAA/////////////////////////////wPoAAAAAP////////////////////////////8D6AAAAAD/////////////////////////////A+gAADhCSU0ECAZHdWlkZXMAAAAAEAAAAAEAAAJAAAACQAAAAAA4QklNBB4NVVJMIG92ZXJyaWRlcwAAAAQAAAAAOEJJTQQaBlNsaWNlcwAAAABtAAAABgAAAAAAAAAAAAALiAAACMMAAAAGADYAMgAuADYAOAA0AAAAAQAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAjDAAALiAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4QklNBBQXTGF5ZXIgSUQgR2VuZXJhdG9yIEJhc2UAAAAEAAAAAThCSU0EIRpWZXJzaW9uIGNvbXBhdGliaWxpdHkgaW5mbwAAAABVAAAAAQEAAAAPAEEAZABvAGIAZQAgAFAAaABvAHQAbwBzAGgAbwBwAAAAEwBBAGQAbwBiAGUAIABQAGgAbwB0AG8AcwBoAG8AcAAgADYALgAwAAAAAQD/4gxQSUNDX1BST0ZJTEUAAQEAAAxATGlubwIQAABtbnRyUkdCIFhZWiAHzgACAAkABgAxAABhY3NwTVNGVAAAAABJRUMgc1JHQgAAAAAAAAAAAAAAAAAA9tYAAQAAAADTLUhQICAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABFjcHJ0AAABUAAAADN3dHB0AAABhAAAABRia3B0AAABmAAAABRyWFlaAAABrAAAABRnWFlaAAABwAAAABRiWFlaAAAB1AAAABRkbW5kAAAB6AAAAHBkbWRkAAACWAAAAIh2dWVkAAAC4AAAAIZ2aWV3AAADaAAAACRsdW1pAAADjAAAABRtZWFzAAADoAAAACR0ZWNoAAADxAAAAAxyVFJDAAAD0AAACAxnVFJDAAAD0AAACAxiVFJDAAAD0AAACAxkZXNjAAAL3AAAAGN0ZXh0AAAAAENvcHlyaWdodCAoYykgMTk5OCBIZXdsZXR0LV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Ju48pXFajx5w9/KI6VpartSrVBm3yF5m3szRQCCOF453g6jppEol9TPaJx4erpZsczBhNTtArNxC7TcOTM6HJ2YzsAHRZGpJ4czyjeep8zTpAIed6xNjpxRyhrmnA7UG231pDgGZDRNykeNht5xiqpZEs6lSkL7h0UOUP66LhavLyMEbWVH1IIgLOlO63T5esY3rL02VvtomXQACbKIWdCf8AAiUl3kNBhpgIbZOqEoFhby98aVef6iu1RKDa068d/wBoqIdc+pnJ1ZzkXKQpXEnaOi02RakecUTTbVZlkrCXG23UrUhWotziUcxG603ll05lq0QkWELlUYbeC3Xni+8rU2sLnhtGamTDbMukqUkvZbEk/wBoLngN6SjbpkWXFO5lzDurjwOpPhyAiJnJpCQtLStCDfKs/wBdo8vVBalHKpJ5XjWDC5x463Ub6Ei8NENsFUki+HZ1+EETPYFcoI5+FQ4z30qZ/eL+0Y0V+0MEEYDfppv+0iMd398EEMKzwNzGWT9vBBGi+CssBBBBHOKj/9k=">
</div>
`, window);

@@ -111,0 +115,0 @@

@@ -88,3 +88,3 @@ // source: https://github.com/OpenSlides/OpenSlides/blob/f4f8b8422f9b3fbab58e35ac3f8f870d35813b7d/client/src/app/core/ui-services/html-to-pdf.service.ts

var parentNodeName = (parentNode ? parentNode.nodeName.toLowerCase() : '');
var ret, text, cssClass, cssStyle;
var ret, text, cssClass;

@@ -106,3 +106,3 @@ // check the node type

// for links
if (parentNodeName === 'a') {
if (parentNodeName === "a") {
ret.link = parentNode.getAttribute("href");

@@ -119,9 +119,3 @@ }

if (ret.text) {
cssStyle = parentNode.getAttribute("style");
if (cssStyle) {
cssStyle = computeStyle(cssStyle);
cssStyle.forEach(function(style) {
ret[style.key] = style.value;
})
}
setComputedStyle(ret, parentNode.getAttribute("style"));
}

@@ -171,2 +165,4 @@ } else {

}
// check if the element has a "style" attribute
setComputedStyle(ret, element.getAttribute("style"));
break;

@@ -190,4 +186,24 @@ }

delete ret._;
// check if the element has a "style" attribute
setComputedStyle(ret, element.getAttribute("style"));
break;
}
case "img": {
ret = {image:element.getAttribute("src")};
ret.style = ['html-img'];
cssClass = element.getAttribute("class");
if (cssClass) {
ret.style = ret.style.concat(cssClass.split(' '));
}
// check if we have 'width' and 'height'
if (element.getAttribute("width")) {
ret.width = parseFloat(element.getAttribute("width"))
}
if (element.getAttribute("height")) {
ret.height = parseFloat(element.getAttribute("height"))
}
// check if the element has a "style" attribute
setComputedStyle(ret, element.getAttribute("style"));
break;
}
}

@@ -297,2 +313,16 @@ // add a custom class to let the user customize the element

/**
* Go throught the CSS styles for the element and apply them
* @param {Object} ret Our pdfmake object
* @param {String} cssStyle The CSS style string
*/
var setComputedStyle = function(ret, cssStyle) {
if (cssStyle) {
cssStyle = computeStyle(cssStyle);
cssStyle.forEach(function(style) {
ret[style.key] = style.value;
})
}
}
var toCamelCase = function(str) {

@@ -299,0 +329,0 @@ return str.replace(/-([a-z])/g, function (g) { return g[1].toUpperCase() });

2

package.json
{
"name": "html-to-pdfmake",
"version": "1.0.1",
"version": "1.0.2",
"description": "Convert HTML code to PDFMake",

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

@@ -245,1 +245,15 @@ var htmlToPdfMake = require('../index.js');

})
test("img",function(t) {
var ret = htmlToPdfMake('<img width="10" style="height:10px" src="data:image/jpeg;base64,...encodedContent...">', window);
t.check(Array.isArray(ret) && ret.length===1, "return is OK");
ret = ret[0];
t.check(
ret.image === "data:image/jpeg;base64,...encodedContent..." &&
ret.width === 10 && ret.height === 10 &&
Array.isArray(ret.style) &&
ret.style[0] === 'html-img',
"<img>");
t.finish();
})

Sorry, the diff of this file is not supported yet

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