markdownからPDF( markdown+css→HTML→PDF )を出力する取り組み.
大量のドキュメントを前提とし,GitHub Actionsで,1ドキュメント1PDFに変換する.
現状の生成物は,各Actionsの実行結果を確認のこと.
CSSなどのスタイルやレイアウトは,授業資料とか技術系のドキュメントなど,自由に組み込める.
CSSや画像はbase64 encodeし,単一HTMLとして出力する.
pandocをbaseとした i13302/pandocイメージを用いる.
Chromeの Page.printToPDF 機能を用いる.
A4サイズでのPDF化,日付のヘッダーやページ番号のフッターの付与が実現する.
i13302/printoutイメージを用いる.
- MarkdownからCSSを維持したHTMLファイルの生成
 - HTMLファイルからPDFの生成
 - ヘッダーやフッターを持つPDFの生成
 - 一連の実行を1手順での自動化
 - 大量のドキュメントへの対応
 
git clone https://github.com/i13302/printout.git
cd printout
Package pandoc Package printout
docker pull ghcr.io/i13302/pandoc
docker pull ghcr.io/i13302/printout
make build
Builded Image i13302/pandoc and i13302/printout.
Create dir is used this system.
make setup
Result.
$ tree work/
work/
├── base
├── css
├── html
├── markdown
└── pdf
The markdown text into work/markdown dir and css into work/css dir.
make run
markdown is builded to PDF file in work/pdf dir.
remove work/html/* and work/pdf/*.
make clean
This is builded in test dir.
make test_run
make test_clean