Snappy と Wkhtmltopdf で生成されたすべてのページのフッターにページ番号を付けたいのですが、それについての手がかりが見つかりませんでした。
フッター テキストを設定することはできますが (オプション 'footer-center' を使用)、ページ番号を設定するにはどうすればよいですか?
Snappy と Wkhtmltopdf で生成されたすべてのページのフッターにページ番号を付けたいのですが、それについての手がかりが見つかりませんでした。
フッター テキストを設定することはできますが (オプション 'footer-center' を使用)、ページ番号を設定するにはどうすればよいですか?
...ここのドキュメントは、一部のタグがページ番号などに置き換えられていることを示しています。
これを受け入れられた回答として追加することは、単なる 404 リンクです。
ドキュメントによると、Wkhtmltopdf は、フッター テキストを配置する場所を制御するための多くのオプションを提供します。
--footer-center <text> Centered footer text
--footer-font-name <name> Set footer font name (default Arial)
--footer-font-size <size> Set footer font size (default 12)
--footer-html <url> Adds a html footer
--footer-left <text> Left aligned footer text
--footer-line Display line above the footer
--no-footer-line Do not display line above the footer
(default)
--footer-right <text> Right aligned footer text
--footer-spacing <real> Spacing between footer and content in mm
(default 0)
フッター(またはヘッダー)内には、いくつかのキーワードがあります
* [page] Replaced by the number of the pages currently being printed
* [frompage] Replaced by the number of the first page to be printed
* [topage] Replaced by the number of the last page to be printed
* [webpage] Replaced by the URL of the page being printed
* [section] Replaced by the name of the current section
* [subsection] Replaced by the name of the current subsection
* [date] Replaced by the current date in system local format
* [isodate] Replaced by the current date in ISO 8601 extended format
* [time] Replaced by the current time in system local format
* [title] Replaced by the title of the of the current page object
* [doctitle] Replaced by the title of the output document
* [sitepage] Replaced by the number of the page in the current site being converted
* [sitepages] Replaced by the number of pages in the current site being converted
たとえば、ページ フッターの右側に実行中のページ番号を追加するには、KnpSnappy で次のようにします。
$snappyPdf->setOption('footer-right', '[page]');