4

Is some pages wkhtmltopdf truncates first row in PDF :

partial

Line has proper height like other lines:

    <!DOCTYPE html>
    <html>
    <head>
        <style>
            * {
                margin: 0;
                padding: 0;
            }

             html, body {
                height: 100%;
                width: 100%;
            }

            .row {
                position: relative;
                clear: both;
            }

            .field {
                font-family: "Times New Roman";
                font-size: 10pt;
                background-color: transparent;
                overflow: hidden;
                word-break: break-all;
                z-index: 2;
            }
   </head><body>
    ....
    <div class='row'><div class='field' style='left:0.13cm;width:3.37cm;height:0.47cm;text-align:right;color:#000080;'>POS sale 136287</div>
    </div>
    <div class='row'><div class='field' style='left:3.68cm;width:1.82cm;height:0.47cm;'>30.01.2016</div>
    </div>
    <div class='row'><div class='field' style='left:5.55cm;width:4.45cm;height:0.47cm;'> Jaeostja </div>
    </div>
    <div class='row'><div class='field' style='left:10.03cm;width:2.53cm;height:0.47cm;text-align:right;'>0,15</div>
    </div>
    <div class='row'></div><div class='row'><div class='field' style='left:15.05cm;width:2.47cm;height:0.47cm;text-align:right;'>-26730,47</div>
  ...

Full html to reproduce is in

https://github.com/wkhtmltopdf/wkhtmltopdf/files/491556/partialline2.zip

Result pdf is in https://github.com/wkhtmltopdf/wkhtmltopdf/files/491558/result.zip

How to show whole line in pdf ?

I tried to add

page-break-inside: avoid !important;
margin: 4px 0 4px 0;  /* to keep the page break from cutting too close to the text in the div */

to row and field classes as described in avoid page break inside row of table

but problem persists.

  • wkhtmltopdf version: 0.12.2.1 (occurs in 0.12.3.2 also)
  • Operating System: Windows 10 Pro 1511

Posted also in https://github.com/wkhtmltopdf/wkhtmltopdf/issues/3141

Community
  • 1
  • 1
Andrus
  • 26,339
  • 60
  • 204
  • 378
  • "Sometimes" - does that mean the exact same code work correctly, for similar text (a table), on other pages? – Jongware Sep 25 '16 at 12:52
  • 1
    It means that first line is corrupted in some pages only. You see in referenced pdf file that for many pages first line is correct. Html file in question contains same height for all rows. All rows have same absolute height `style='... height:0.47cm`. They are corrupted only in some pages. – Andrus Sep 25 '16 at 14:49
  • @RadLexus I edited question and changed `sometimes` to `in some pages` – Andrus Sep 25 '16 at 15:03

0 Answers0