Skip to content

Commit

Permalink
Fixed Issue #17
Browse files Browse the repository at this point in the history
Fixed #17
  • Loading branch information
Aymkdn committed Oct 12, 2019
1 parent 71f35f3 commit 8338306
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ module.exports = function(htmlText, options) {
var value = styleDef[1];
switch (key) {
case "margin": {
value = value.replace(/(\d+)([^\d]+)/g,"$1 ").trim().split(' ');
value = value.replace(/(\d+)(\.\d+)?([^\d]+)/g,"$1$2 ").trim().split(' ');
// pdfMake uses a different order than CSS
if (value.length===1) value=+value[0]; // single value
else if (value.length===2) value=[+value[1], +value[0]]; // vertical | horizontal ==> horizontal | vertical
Expand Down Expand Up @@ -419,7 +419,7 @@ module.exports = function(htmlText, options) {
default: {
if (key.indexOf("-") > -1) key=toCamelCase(key);
if (value) {
value = value.replace(/(\d+)([^\d]+)/g,"$1 ").trim();
value = value.replace(/(\d+)(\.\d+)?([^\d]+)/g,"$1$2 ").trim();
if (!isNaN(value)) value=+value; // turn it into a number
ret.push({key:key, value:value});
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "html-to-pdfmake",
"version": "1.1.1",
"version": "1.1.2",
"description": "Convert HTML code to PDFMake",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 8338306

Please sign in to comment.