You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+6-7Lines changed: 6 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Template renderer
2
2
3
-
Creating PDF documents is a common task in software development. This repository shows how to create PDF's from HTML templates with the help of three remarkable open source projects. It shows a free and open source alternative to commercial software like Aspose.Pdf or Exstream.
3
+
Creating PDF documents is a common task in software development. This repository shows how to create PDF's from HTML templates using three remarkable open source projects. It shows a free and open source alternative to commercial software like Aspose.Pdf or Exstream.
4
4
5
5
## General information
6
6
@@ -25,10 +25,10 @@ An open source library to paginate HTML content for printing to PDF. This librar
25
25
<https://www.adamhyde.net/some-pagedjs-info>\
26
26
License: See project, MIT license at time of writing
27
27
28
-
### Implementation
28
+
### Source code
29
29
30
-
- template-renderer.js - Combines Puppeteer and mustache.js with just a few lines to create PDF's from mustache HTML templates.
31
-
- tests/pagedjs/pagedjs.html - Uses Paged.js to create a document with a table of contents and page numbers.
30
+
-[template-renderer.js](/template-renderer.js) - Combines Puppeteer and mustache.js with just a few lines of code in order to create PDF's from mustache HTML templates.
31
+
-[tests/pagedjs/pagedjs.html](/tests/pagedjs/pagedjs.html) - Uses Paged.js to create a document with a table of contents and page numbers.
32
32
33
33
### Typesetting with CSS
34
34
@@ -41,7 +41,7 @@ Browsers provide some interesting options for typesetting. For example the follo
41
41
-**text-align: justify** - align text to the left and right edges of lines, except at the last line
42
42
-**hyphens: auto** - words are hyphenated according to language-specific hyphenation rules, where the language should be specified with a lang attribute
43
43
44
-
**Note:** It seems that Puppeteer does not yet handle hyphens correctly. Two possible workarrounds are [hyphen](https://www.npmjs.com/package/hyphen) (node) and [Hyphenopoly](https://github.com/mnater/Hyphenopoly) (browser).
44
+
**Note:** It seems that Puppeteer does not yet handle hyphens correctly. Two possible workarounds are [hyphen](https://www.npmjs.com/package/hyphen) (node) and [Hyphenopoly](https://github.com/mnater/Hyphenopoly) (browser).
45
45
46
46
## Security
47
47
@@ -52,7 +52,6 @@ Some remarks concerning security.
52
52
- Only allow access from trusted services. This is often achieved using json web tokens. Thanks to the package [jsonwebtoken](https://github.com/auth0/node-jsonwebtoken) this was easily implemented in template-renderer.js.
53
53
- For serving over https see <https://expressjs.com/en/5x/api.html#app.listen> and <https://nodejs.org/api/https.html#httpscreateserveroptions-requestlistener>.
54
54
55
-
56
55
## Getting started
57
56
58
57
### Npm commands
@@ -97,7 +96,7 @@ function createTokenValidationFunction(url, requiredScope) {
97
96
functiongetKey(header, callback) {
98
97
client.getSigningKey(header.kid, function (err, key) {
99
98
if (err) {
100
-
logger.error({ message: err });
99
+
logger.error({ message:err.message });
101
100
}
102
101
var signingKey = key?.publicKey|| key?.rsaPublicKey;
0 commit comments