fixed font embedding
This commit is contained in:
parent
f0686e0a06
commit
0301a255fa
13
README.md
13
README.md
@ -15,16 +15,23 @@ To generate PDFs:
|
|||||||
2. `mkdir -p rendered`
|
2. `mkdir -p rendered`
|
||||||
3. `node index.mjs`
|
3. `node index.mjs`
|
||||||
|
|
||||||
|
Note that the fonts "Schibsted Grotesk" and "Sometype Mono" must be installed
|
||||||
|
on the system.
|
||||||
|
|
||||||
|
Also note that this uses Firefox instead of Chrome to generate the PDFs.
|
||||||
|
Chrome seems to embed the fonts as Type 3 fonts, which are bad for printing.
|
||||||
|
Firefox seems to embed them as TrueType or Type 1C, which are better.
|
||||||
|
|
||||||
```
|
```
|
||||||
tmont@thelio:~/code/sources-of-light (main +) node index.mjs
|
$ node index.mjs
|
||||||
processing 001-title.html...
|
processing 001-title.html...
|
||||||
generated PDF at /home/tmont/code/sources-of-light/rendered/001-title.pdf
|
generated PDF at /home/tmont/code/sources-of-light/rendered/001-title.pdf
|
||||||
processing 002-title2.html...
|
processing 002-title2.html...
|
||||||
generated PDF at /home/tmont/code/sources-of-light/rendered/002-title2.pdf
|
generated PDF at /home/tmont/code/sources-of-light/rendered/002-title2.pdf
|
||||||
processing 003-toc.html...
|
processing 003-toc.html...
|
||||||
generated PDF at /home/tmont/code/sources-of-light/rendered/003-toc.pdf
|
generated PDF at /home/tmont/code/sources-of-light/rendered/003-toc.pdf
|
||||||
processing 197-timeline.html...
|
processing 196-timeline.html...
|
||||||
generated PDF at /home/tmont/code/sources-of-light/rendered/197-timeline.pdf
|
generated PDF at /home/tmont/code/sources-of-light/rendered/196-timeline.pdf
|
||||||
```
|
```
|
||||||
|
|
||||||
Rendered pages will be in `rendered/`.
|
Rendered pages will be in `rendered/`.
|
||||||
|
@ -14,7 +14,8 @@ const files = fs.readdirSync(path.join(dirname, 'pages'))
|
|||||||
.map(file => path.join(dirname, 'pages', file));
|
.map(file => path.join(dirname, 'pages', file));
|
||||||
|
|
||||||
const browser = await puppeteer.launch({
|
const browser = await puppeteer.launch({
|
||||||
executablePath: '/usr/bin/google-chrome',
|
browser: 'firefox',
|
||||||
|
executablePath: '/usr/bin/firefox',
|
||||||
});
|
});
|
||||||
const page = await browser.newPage();
|
const page = await browser.newPage();
|
||||||
|
|
||||||
@ -23,9 +24,7 @@ for (const file of files) {
|
|||||||
|
|
||||||
console.log(`processing ${path.basename(file)}...`);
|
console.log(`processing ${path.basename(file)}...`);
|
||||||
|
|
||||||
await page.goto(`file://${file}`, {
|
await page.goto(`file://${file}`);
|
||||||
waitUntil: 'networkidle0',
|
|
||||||
});
|
|
||||||
|
|
||||||
await page.pdf({
|
await page.pdf({
|
||||||
width: '9.25in',
|
width: '9.25in',
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>Title</title>
|
<title>Title</title>
|
||||||
<link rel="stylesheet" href="../fonts/SchibstedGrotesk/style.css"/>
|
|
||||||
<style>
|
<style>
|
||||||
body {
|
body {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>Title 2</title>
|
<title>Title 2</title>
|
||||||
<link rel="stylesheet" href="../fonts/SchibstedGrotesk/style.css"/>
|
|
||||||
<style>
|
<style>
|
||||||
body {
|
body {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>ToC</title>
|
<title>ToC</title>
|
||||||
<link rel="stylesheet" href="../fonts/SometypeMono/style.css"/>
|
|
||||||
<style>
|
<style>
|
||||||
body {
|
body {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>Timeline</title>
|
<title>Timeline</title>
|
||||||
<link rel="stylesheet" href="../fonts/SchibstedGrotesk/style.css" />
|
|
||||||
<style>
|
<style>
|
||||||
body {
|
body {
|
||||||
margin: 0;
|
margin: 0;
|
Loading…
Reference in New Issue
Block a user