Need support: 2 sections in 1 page. #1654
Comments
Can you post the exact command line you used to generate the above PDF? |
I use https://github.com/incuna/django-wkhtmltopdf in Django project. I debug from code and I got this command.
|
Can you update your initial post to include the contents of |
Please see below:
|
Any clue? |
Not really, haven't gotten time to look into it this week. |
Ok. I understand you have a lot of work to do. I'm going to find another way to do this. Thanks anyway. |
Very interesting. I've tested this with 0.11.0rc2 on OSX and the problem is the same, so at least it wasn't introduced by changes in the 0.12x branch. I've investigated this a little bit further and it seems that if there is more than one heading on a page, only the first one is used, all others are ignored for the following pages which don't have headings. This isn't only true for the first page but for all pages. And it is also true for other headings (h2, h3 respectively subsection and subsubsection). If this should be fixed in the future the question arises which section name should be passed to the header/footer html, if there is more than one section on the page, the first or the last section name? I'd vote for the first one, IMO this is more appropriate. |
I have the same issue. mn4367 asks earlier "If this should be fixed in the future the question arises which section name should be passed to the header/footer html, if there is more than one section on the page, the first or the last section name?". mn4367 writes "I'd vote for the first one". Me too, except for that it is not that simple. There might be 0, 1 or n sections on any page. wkhtmltopdf currently missbehaves in the 0-scenario. I would vote for:
Example. Header: |
3 years and still open? |
is this issue fixed? any solution? |
Hi <?php
require './vendor/autoload.php';
$optionsForAllPage = array(
'header-html' => './common/header/header-template-1.html',
);
$optionsForSpecificPage = array(
'header-html' => './common/header/header-template-2.html',
);
$pdf = new Pdf();
$pdf->addCover('http://localhost:8888/pdf/cover-page.html');
for ($x = 0; $x <= 10; $x++) {
$pdf->addPage('http://localhost:8888/pdf/page/home-page-' . $x . '.html', $optionsForAllPage);
$pdf->addPage('http://localhost:8888/pdf/page/index-page-' . $x . '.html', $optionsForAllPage);
$pdf->addPage('http://localhost:8888/pdf/page/user-page-' . $x . '.html', $optionsForAllPage);
$pdf->addPage('http://localhost:8888/pdf/page/reference-page-' . $x . '.html', $optionsForSpecificPage);
}
$pdf->setOptions($options);
if (!$pdf->saveAs('out.pdf')) {
$error = $pdf->getError();
echo $error;die;
}
?> |
I put 2 h1s in first page. There are 2 pages.
Then I put script into the header html file.
Here is footer html:
At the header, it says 'First section' on both page.
Please see result: http://rutcreate.com/s1.pdf
The text was updated successfully, but these errors were encountered: