Set the pdf page content



  • Hi!
    I'm using phantom-pdf to make invoice from xml files that i convert in json and then in pdf.
    I have a problem printing a table information inside a page without it being cut off. I'll explain. The invoice can contain several tables with information whose number is variable. Initially I printed three tables for each page by playing with margins and padding, but as these tables do not have a static number of lines they may not come into a page and then end up in the other. The result is that information is cut. Also, having set a height of the div that identifies the page, this leads to problems with the next pages.
    I do not know if I explained correctly. Any ideas on how to proceed?

    P.S. sorry for my English.


  • administrators

    The invoice can contain several tables with information whose number is variable. Initially I printed three tables for each page by playing with margins and padding, but as these tables do not have a static number of lines they may not come into a page and then end up in the other. The result is that information is cut.

    hmm if the problem is that tables are cut in middle of pages (so they end up looking bad), maybe applying this css class could solve that problem.

    .unbreakable
    {
        /* page-break-inside: avoid !important; <-- doesn't work*/
        display:inline-block;
    }
    .unbreakable:after
     {
        display:block;
        height:0px;
        visibility: hidden;
    }
    

    apply the .unbreakable css class to the tables and it should prevent that they end up cut between pages. but i'm not sure if this solution will cause some troubles with the height of the div that represents the page.



  • it doesn't work. Why page-break doesn't work too?
    i think i should use javascript.


  • administrators

    it doesn't work. Why page-break doesn't work too?

    because a phantomjs bug, they don't support page-break avoid very well

    the unbreakable css class has worked for me in the past very well, not sure why it does not work for you, have you tried to apply it to the parent of the table too? if you can share an example in playground i can take a quick look later, maybe there is something to do



  • I use page break to identify the page, but it work only there.
    I don't know if a can post it in playground. I'll try.
    Thanks for your help.


Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.