Skip to content

Commit

Permalink
Better printed ebook, including a cover (#1069)
Browse files Browse the repository at this point in the history
* Change to A5 size for printing

* Add cover

* Fix cover

* Remove unnecssary code

* Fix some rems

* Fix contributors and ass printer setting

* Better alignment of cover

* Finish cover

* Make ebook resizable

* Extra params

* More rem-based styles

* Linting issues

* Update README

* Regen ebooks

* Handle large images

* Merge cover and ebook into one template

* Fix bad padding

* Merge from main

* Add Japanese version

* Move title down on cover and simplify cover args

* Better ebook instructions

* Linting errors

* Review feedback
  • Loading branch information
tunetheweb committed Jul 20, 2020
1 parent bcb4b61 commit 613821e
Show file tree
Hide file tree
Showing 16 changed files with 736 additions and 166 deletions.
2 changes: 1 addition & 1 deletion .github/linters/.stylelintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"value-keyword-case": [
"lower",
{
"ignoreKeywords": ["Art","A4"]
"ignoreKeywords": ["Art","A4","A5"]
}
]
}
Expand Down
58 changes: 52 additions & 6 deletions src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,21 +70,67 @@ npm run generate
npm run ebooks
```

It is also possible to generate the ebook from the website, with some optional params (e.g. to print it!)
## Generating ebooks - including print-ready ebooks if you want a hardcopy

It is also possible to generate the ebook from the website (either production or 127.0.0.1), with some optional params (e.g. to print it!)

```
prince "https://almanac.httparchive.org/en/2019/ebook?print&inside-margin=4cm" -o web_almanac_2019_en.pdf --pdf-profile='PDF/UA-1'
prince "http://127.0.0.1:8080/en/2019/ebook?print" -o web_almanac_2019_en.pdf --pdf-profile='PDF/UA-1'
```

Note `--pdf-profile='PDF/UA-1'` may not be needed if just intend to print.

Params accepted are:
Query params accepted are:

- print - this ads left, right pages, footnotes, and sets roman numerals for front matter page numbers and adds footnotes. It is used by default when running `npm run ebooks` but we could change that if prefer a less print-like ebook.
- page-size - this allows you to override the default page size of A4
- print - this adds left, right pages, footnotes, and sets roman numerals for front matter page numbers and adds footnotes. It is used by default when running `npm run ebooks` but we could change that if prefer a less print-like ebook.
- printer - this adds crop marks, bleeds and trims. Also adds two additional pages at front which will need to be deleted in Acrobat or similar to get clean starting page.
- page-size - this allows you to override the default page size of A5.
- inside-margin - this allows you to set an inside margin for binding (e.g. on right for left hand pages and vice versa)
- bleed - add a bleed for printing (3mm by default)
- prince-trim - add a bleed for printing (5mm by default)
- base-font-size - set the base font-size (10px by default), which is useful if changing page size.
- max-fig-height - defaults to 610px (for A5) and prevents large images from causing overflows on to other pages with heading and caption.
- cover - this genarates a 4 page cover (front cover + spine + back cover, and same on inside which is blank). This ignores above options but has further params discussed below.

You can also download the HTML and override the inline styles there if you want to customise this for something we haven't exposed as a param.

So for a printer-ready A5 version, that you can send to a print to bind, you can do the following:

```
prince "http://127.0.0.1:8080/en/2019/ebook?print&printer" -o static/pdfs/web_almanac_2019_en_print_A5.pdf
```

This is the same as below since it uses all the default settings:

```
prince "http://127.0.0.1:8080/en/2019/ebook?print&printer&page-size=A5&inside-margin=19.5mm&bleed=3mm&prince-trim=5mm&base-font-size=10px" -o static/pdfs/web_almanac_2019_en_print_A5.pdf
```

Note this will create two extra pages at the begining which will need to be removed with a PDF editor (e.g. Adobe Acrobat) to start with a clean page starting on right hand side for printing. Please remove these before checking in versions into git.

It is also possible to generate a cover using the `&cover` URL param. This consists of basically 2 pages - the first page is a double width-page with front and back cover as one page (with spine in between) and the second page is a blank inside page.

```
prince "http://127.0.0.1:8080/en/2019/ebook?cover" -o static/pdfs/web_almanac_2019_en_cover_A5.pdf
```

Extra params accepted for the cover are are (note spine and pageWidth are unit-less to allow for easy addition in the code):

- spine - defaults to 25
- pageWidth - defaults to 148 (for A5). Note this is the front cover width and not the full width of front cover and back cover and spine.
- pageHeight - defaults to 210 (for A5)
- unit - which unit the above measurements are in (defaults to mm)
- base-font-size - set the base font-size (10px by default), which may need to be increased if changing page size.

So default is the same as:

```
prince "http://127.0.0.1:8080/en/2019/ebook?cover&spine=25&pageWidth=148&pageHeight=210&unit=mm&base-font-size=10px" -o static/pdfs/web_almanac_2019_en_cover_A5.pdf
```

Note, simialr to above, this will create one extra page at the begining which will need to be removed with a PDF editor to start with a clean page for printing. Please remove this before checking in versions into git.

You can also download the HTML and override the inline styles there if you want to customise this for something we haven;t exposed as a param.
With the print-ready eBook and Cover you can send them to a printer. I used https://www.digitalprintingireland.ie/ before and they were excellent and charge about €35 for a full-colour A5 ebook. Most of the settings above are for them, so tweak them based on your own printer's requirements.

## Deploying changes

Expand Down
Loading

0 comments on commit 613821e

Please sign in to comment.