mardi 25 juillet 2017

DOMPDF page-break-inside:avoid; property is leaving a blank at start of the pdf

In my code I am trying to add a external border frame to the pdf, but when I do so, the content of my pdf breaks in between and continue in second page. To overcome that Issue I used page-break-inside:avoid; property on parent div. But this resulted in a new strange issue, its keeping the first page blank (without border) and adding the whole content to second page (With border) of pdf.

No way for me to understand what I am doing wrong.

I am detailing dummy code snippet below -

<style type="text/css">
@page { margin: 0px; }
body { margin: 0px; }
html { margin: 0px;}
.back-img
{
    background: url('ImageURL');
    background-position: top left;
    background-repeat: no-repeat;
    background-size: 100%;
    padding-top: 100px;
    padding-left: 100px;
    padding-right: 100px;
    width:100%;
    height:100%;
}
</style>
<div style="page-break-inside:avoid;" class="back-img">
    <div style="text-align: center;">
        <h1>Heading Text</h1>
        <br>
        <img src="ImgURL" height="100">
        <br><br>
        Some Text Here
        <br>
        Some Text Here.. Some text here..
        <br>
        Some Text Here
        <br><br>
        Some Text Here
        <br><br>
        3-4 lines of paragraph here
        <br><br>
        <img src="ImgURL" height="50">
        <br>
        Some text Here
        <br>
        Some Text Here
        <br>
        Some Text Here
    </div>
</div>

Dompdf version is 0.7.0 PHP version is 7.0.18

Your help is much appreciated.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire