ralfbiedert / cheats.rs

Rust Language Cheat Sheet - https://cheats.rs
https://cheats.rs
4.14k stars 395 forks source link

pdf has no page number #155

Closed time4Wiley closed 9 months ago

time4Wiley commented 2 years ago

rust_cheat_sheet-numbered.pdf

Attached a numbered one by manually uploading to service from https://smallpdf.com/add-page-numbers-to-pdf

time4Wiley commented 2 years ago

Would be great if the cached one can have page number.

ralfbiedert commented 2 years ago

There is probably a setting in the generation script somewhere, PRs welcome.

time4Wiley commented 2 years ago

in .github/workflows/generate_release.yml, it references the following code:

./generate_pdf.sh cheats.rs/rust_cheat_sheet.pdf

Needs to look into generate_pdf.sh

it uses google-chrome as stated in the actual code snippet producing the pdf in docker/generate_pdf.sh

google-chrome --headless --disable-gpu --print-to-pdf=$output --print-to-pdf-no-header http://localhost:1111#_print

Found another docker image docker-html-to-pdf that references a npm package chrome-headless-render-pdf supporting the following options:

--header-template HTML template for the header. Inject variables using the classes "date", "title", "url", "pageNumber" or "totalPages" --footerTemplate HTML template for the footer. Inject variables using the classes "date", "title", "url", "pageNumber" or "totalPages"

ralfbiedert commented 9 months ago

Seems to work now.