You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
3.3 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. How To Create PDF (on macOS)
  2. ============================
  3. PDF file can also be purchased here: https://transactions.sendowl.com/products/78175486/4422834F/view
  4. Setup
  5. -----
  6. * Install Adobe Acrobat Pro DC.
  7. * Copy headers and footers from `pdf/adobe/` folder to `/Users/<username>/Library/Preferences/Adobe/Acrobat/DC/HeaderFooter/`.
  8. * Change date in header and footer element of `web/template.html`.
  9. * Run `./parse.js` and commit changes.
  10. Printing to PDF
  11. ---------------
  12. ### Normal PDF
  13. * Open `index.html` in text editor and first remove element `<p><br></p>` before the `<h1>Libraries</h1>`.
  14. * Then replace the footer and last three `<br>` elements with contents of `pdf/index_for_pdf.html` file and save.
  15. * Open `index.html` in Chrome and select 'Print...'.
  16. * Select destination 'Save as PDF', paper size 'A4', margins and scale 'Default' and no headers and footers and save.
  17. ### PDF optimized for laser color printing
  18. * Run `./parse.js` again.
  19. * Open `index.html` in text editor and first remove element `<p><br></p>` before the `<h1>Libraries</h1>`.
  20. * Then replace the footer and last three `<br>` elements with contents of `pdf/index_for_pdf_print.html` file.
  21. * Change all links in text to normal text and optionally add a page number after '(p. <num>)'. Links can be found with this regex: `<strong>.*a href.*</strong>`.
  22. * Save and open `index.html` in Chrome.
  23. * Change brightness of elements by right clicking on them and selecting inspect. Then click on the rectangle that represents color and toggle the color space to HSLA by clicking on the button with two vertical arrows.
  24. * Change lightness (L) percentage to:
  25. * 0% for the text.
  26. * 87% for the gray line on the left side of the code.
  27. * 89% for the gray hash characters by the titles
  28. * 37% for the red text and function names (they use their own red).
  29. * 60% for the blue text and the text in the contents (it uses its own blue), but leave color of decorators and the `>>>` intact.
  30. * 58% for the comments.
  31. * Individually change brightness of every comment line that starts with: `# $ pip3 install
  32. ...` and of comments in basic script template to 57%, by adding `color: hsla(0, 0%, 57%, 1);` to their element.style.
  33. * Select 'Print...' and destination 'Save as PDF', paper size 'A4', margins and scale 'Default' and no headers and footers and save.
  34. Adding headers and footers to PDF (the same for both files)
  35. -----------------------------------------------------------
  36. * Open the PDF file in Adobe Acrobat Pro DC.
  37. * Select 'Organize Pages' tab and remove last empty page.
  38. * Right click on one of the pages and select 'Crop Pages...'.
  39. * In 'Change page size' section select 'A4' for 'Page Sizes' set 'XOffset' to '0.1 in' and select page range All.
  40. * Select 'Edit PDF' tab and add headers and footers by clicking 'Header & Footer' button, selecting a preset from 'Saved Settings' dropdown menu and clicking ok. Repeat the process for each preset.
  41. * If presets get lost, the font and the margins are as follow: Borders: left-line: 0.6, left-text: 0.8, top-line: 11.4, bottom-text: 0.27, right-text-odd: 0.57, font-name: menlo, font-size: 8.
  42. * Set title and author by selecting 'File/Properties...'.
  43. * Save.
  44. Printing the PDF
  45. ----------------
  46. * Open a PDF that was optimized for printing in Chrome and print on A4 on both sides with default margins, scale 98% and no headers and footers.