Skip to content

pageNumber and totalPages are not displayed in footerTemplate #66

Closed
@riatw

Description

@riatw

Please check the title.
How can I resolve this?

code

use Spiritix\Html2Pdf\Converter;
use Spiritix\Html2Pdf\Input\UrlInput;
use Spiritix\Html2Pdf\Output\EmbedOutput;

$input = new UrlInput();
$input->setUrl($requestTmplUrl);

$converter = new Converter($input, new EmbedOutput());

$footerTemplate = <<<END
<div style="font-family: '游ゴシック体', 'Yu Gothic', YuGothic, 'ヒラギノ角ゴ Pro', 'Hiragino Kaku Gothic Pro', 'メイリオ', 'Meiryo', sans-serif; position: relative; margin: 0.5cm 1cm; font-size: 9px; width: 100%;">
  <div style="position: absolute; left: 0; top: 0.5cm;">Site Title</div>
  <div style="position: absolute; width: 100%; top: 0.5cm; text-align: center;">
    <span class="pageNumber"></span> / <span class="totalPages"></span>
  </div>
  <div style="position: absolute; right: 0; top: 0.5cm;">$footerRight</div>
</div>
END;

$converter->setOptions([
    'printBackground' => true,
    'displayHeaderFooter' => true,
    'margin' => array('top' => '1cm','right' => '1cm','bottom' => '0cm','left' => '1cm',),
    'footerTemplate' => $footerTemplate,
]);

$output = $converter->convert();
$output->embed($title . ".pdf");

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions