Skip to content

Commit

Permalink
Merge branch 'master' into features/table-alignment
Browse files Browse the repository at this point in the history
  • Loading branch information
liborm85 committed Jan 6, 2024
2 parents 15a4871 + 7af85a9 commit c544fd7
Show file tree
Hide file tree
Showing 16 changed files with 62,292 additions and 62,299 deletions.
1 change: 0 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"jsdoc/check-param-names": 1,
"jsdoc/check-tag-names": 1,
"jsdoc/check-types": 1,
"jsdoc/newline-after-description": 1,
"jsdoc/no-undefined-types": 1,
"jsdoc/require-description": 0,
"jsdoc/require-description-complete-sentence": 0,
Expand Down
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
# Changelog

## Unreleased
## 0.3.0-beta.7 - 2024-01-01

- Minimal supported version Node.js 16 LTS
- Added padding option for QR code
- Allow the document language to be specified
- Fixed cover image size inside table
- Fixed "Cannot read properties of undefined (reading 'bottomMost')" if table contains too few rows
- Fixed invalid source-maps in builded js file

## 0.3.0-beta.6 - 2023-11-09

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
The MIT License (MIT)

Copyright (c) 2014-2015 bpampuch
2016-2022 liborm85
2016-2024 liborm85

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
Expand Down
124,502 changes: 62,236 additions & 62,266 deletions build/pdfmake.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/pdfmake.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions build/pdfmake.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/pdfmake.min.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dev-playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "pdfmake-server-playground",
"version": "0.0.0",
"dependencies": {
"body-parser": "^1.18.2",
"express": "^4.16.2"
"body-parser": "^1.20.2",
"express": "^4.18.2"
}
}
Binary file modified examples/pdfs/standardfonts.pdf
Binary file not shown.
5 changes: 5 additions & 0 deletions examples/qrCode.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,13 @@ var docDefinition = {
header('A very long text (' + longText.length + ' chars)'),
{ qr: longText },
'\n',

header('same long text with fit = 100 and alignment = right'),
{ qr: longText, fit: 150, alignment: 'right' },
'\n',

header('same long text with fit = 100 and padding = 1 modules in pixel'),
{ qr: longText, fit: 150, padding: 1 },
]
};

Expand Down
3 changes: 2 additions & 1 deletion examples/standardfonts.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ var docDefinition = {
],
defaultStyle: {
font: 'Helvetica'
}
},
language: "en-AU"
};

var now = new Date();
Expand Down
41 changes: 21 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pdfmake",
"version": "0.3.0-beta.6",
"version": "0.3.0-beta.7",
"description": "Client/server side PDF printing in pure JavaScript",
"main": "js/index.js",
"esnext": "src/index.js",
Expand All @@ -12,40 +12,41 @@
"@foliojs-fork/linebreak": "^1.1.1",
"@foliojs-fork/pdfkit": "^0.14.0",
"iconv-lite": "^0.6.3",
"xmldoc": "^1.1.2"
"xmldoc": "^1.3.0"
},
"devDependencies": {
"@babel/cli": "^7.16.7",
"@babel/core": "^7.16.7",
"@babel/plugin-transform-modules-commonjs": "^7.16.7",
"@babel/preset-env": "^7.16.7",
"assert": "^2.0.0",
"babel-loader": "^8.2.3",
"@babel/cli": "^7.23.4",
"@babel/core": "^7.23.6",
"@babel/plugin-transform-modules-commonjs": "^7.23.3",
"@babel/preset-env": "^7.23.6",
"assert": "^2.1.0",
"babel-loader": "^9.1.3",
"brfs": "^2.0.2",
"browserify-zlib": "^0.2.0",
"buffer": "6.0.3",
"core-js": "3.19.0",
"eslint": "^8.5.0",
"eslint-plugin-jsdoc": "^37.4.2",
"expose-loader": "^3.1.0",
"eslint": "^8.55.0",
"eslint-plugin-jsdoc": "^46.9.1",
"expose-loader": "^4.1.0",
"file-saver": "^2.0.5",
"mocha": "^9.1.3",
"mocha": "^10.2.0",
"npm-run-all": "^4.1.5",
"process": "^0.11.10",
"rewire": "^6.0.0",
"shx": "^0.3.3",
"sinon": "^12.0.1",
"rewire": "^7.0.0",
"shx": "^0.3.4",
"sinon": "^17.0.1",
"source-map-loader": "^4.0.1",
"stream-browserify": "^3.0.0",
"string-replace-webpack-plugin": "^0.1.3",
"svg-to-pdfkit": "^0.1.8",
"terser-webpack-plugin": "^5.3.0",
"terser-webpack-plugin": "^5.3.9",
"transform-loader": "^0.2.4",
"util": "^0.12.4",
"webpack": "^5.65.0",
"webpack-cli": "^4.9.1"
"util": "^0.12.5",
"webpack": "^5.89.0",
"webpack-cli": "^5.1.4"
},
"engines": {
"node": ">=14"
"node": ">=16"
},
"scripts": {
"test": "run-s build mocha lint",
Expand Down
1 change: 1 addition & 0 deletions src/Printer.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class PdfPrinter {
userPassword: docDefinition.userPassword,
ownerPassword: docDefinition.ownerPassword,
permissions: docDefinition.permissions,
lang: docDefinition.language,
fontLayoutCache: typeof options.fontLayoutCache === 'boolean' ? options.fontLayoutCache : true,
bufferPages: options.bufferPages || false,
autoFirstPage: false,
Expand Down
4 changes: 4 additions & 0 deletions src/TableProcessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ class TableProcessor {
this.cleanUpRepeatables = false;

this.headerRows = tableNode.table.headerRows || 0;
if (this.headerRows > tableNode.table.body.length) {
throw new Error(`Too few rows in the table. Property headerRows requires at least ${this.headerRows}, contains only ${tableNode.table.body.length}`);
}

this.rowsWithoutPageBreak = this.headerRows + (tableNode.table.keepWithHeaderRows || 0);
this.dontBreakRows = tableNode.table.dontBreakRows || false;

Expand Down
8 changes: 5 additions & 3 deletions src/qrEnc.js
Original file line number Diff line number Diff line change
Expand Up @@ -748,11 +748,13 @@ function buildCanvas(data, options) {
var canvas = [];
var background = options.background || '#fff';
var foreground = options.foreground || '#000';
var padding = options.padding || 0;
//var margin = options.margin || 4;
var matrix = generateFrame(data, options);
var n = matrix.length;
var modSize = Math.floor(options.fit ? options.fit / n : 5);
var size = n * modSize;
var size = (n * modSize) + (modSize * padding * 2);
var paddingXY = modSize * padding;

canvas.push({
type: 'rect',
Expand All @@ -764,8 +766,8 @@ function buildCanvas(data, options) {
if (matrix[i][j]) {
canvas.push({
type: 'rect',
x: modSize * j,
y: modSize * i,
x: modSize * j + paddingXY,
y: modSize * i + paddingXY,
w: modSize,
h: modSize,
lineWidth: 0,
Expand Down
5 changes: 5 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ module.exports = {
})
}
},
{
enforce: "pre",
test: /\.(cjs|js)$/,
use: ["source-map-loader"],
},
{
test: /\.js$/,
include: /(pdfkit|linebreak|fontkit|saslprep|restructure|unicode-trie|unicode-properties|dfa|buffer|png-js|crypto-js)/,
Expand Down

0 comments on commit c544fd7

Please sign in to comment.