导出为PDF时,表行没有分页符

时间:2017-02-27 05:06:12

标签: html css pdf

将表导出为PDF时,表行不会进行分页。我试图在每个表格行上使用以下内容进行分页:

<tr style='page-break-inside:avoid;'>

表行中断如下(导出到PDF - 在浏览器中查看):

enter image description here

我想要排桌&#39; Vrsta blaga / storitve&#39;保持紧凑。因此,单元格不会显示在不可打印的区域中,如上图所示。这可能吗?我应该使用什么造型?这是我的代码:

&#13;
&#13;
<style>#tblArticles{font-size: 12px !important; font-family: verdana, sans-serif; border-collapse: collapse; width: 100%;}
#tblArticles td{border: 1px solid black;text-align: center;padding: 8px;}
#tblArticles th {border: 1px solid black;text-align: center;padding: 8px;background-color: #dddddd;}
</style>
<style>#tblLeft{position:absolute;left:0; font-size: 10px !important; font-family: verdana, sans-serif;border-collapse:collapse; width:40%;}
#tblLeft td{font-size: 10px !important; border: 1px solid black;text-align: center;padding: 8px;}
#tblLeft th {font-size: 10px !important; border: 1px solid black;text-align: center;padding: 8px;background-color: #dddddd;}</style>
<style>#tblRight{position:absolute;right:0; font-size: 10px !important; font-family: verdana, sans-serif;border-collapse:collapse; width:20%;}
#tblRight td{font-size: 10px !important; text-align: center;padding: 8px;}</style>
<table id='tblArticles'>
<thead>
<th>Vrsta blaga/storitve</th>
                                <th>Interna številka</th>
                                <th>Prodana koda</th>
                                <th>Količina</th>
                                <th>EnM</th>
                                <th>Cena brez DDV</th>
                                <th>Vrednost brez DDV</th>
                                <th>DDV</th>
                                <th>Znesek DDV</th>
                                <th>Vrednost z DDV</th>
</thead>
<tfoot>
<tr style='visibility:hidden;'><td></td></tr>
<tr style='visibility:hidden;'><td></td></tr>
<tr style='visibility:hidden;'><td></td></tr>
</tfoot>
<tbody style='page-break-inside:avoid;'>
<tr style='page-break-inside:avoid;'>
<td rowspan='2'><label>Mali kuharski mojster</label></td>
<td>
<img src=http://localhost:53358/resources/Images/EAN128/VFdNNE5TIE1L.jpg><br/>
<label>VFdNNE5TIE1L</label><br/>
</td>
<td><input type='checkbox'><br/><label></label><br/></td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='2'>2,00</td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='2'>KOM</td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='2'>32,21 €</td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='2'>64,42 €</td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='2'>22,00 %</td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='2'>14,17 €</td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='2'>78,59 €</td>
</tr>
<tr style='page-break-inside:avoid;'>
<td>
<img src=http://localhost:53358/resources/Images/EAN128/VjJUOEVaIE1L.jpg><br/>
<label>VjJUOEVaIE1L</label><br/>
</td>
<td><input type='checkbox'><br/><label></label><br/></td>
</tr>
<tr style='page-break-inside:avoid;'>
<td rowspan='12'><label>Veliki kuharski mojster</label></td>
<td>
<img src=http://localhost:53358/resources/Images/EAN128/NFA1SFFKVks=.jpg><br/>
<label>NFA1SFFKVks=</label><br/>
</td>
<td><input type='checkbox'><br/><label></label><br/></td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='12'>12,00</td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='12'>KOM</td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='12'>65,69 €</td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='12'>788,28 €</td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='12'>22,00 %</td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='12'>173,42 €</td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='12'>961,70 €</td>
</tr>
<tr style='page-break-inside:avoid;'>
<td>
<img src=http://localhost:53358/resources/Images/EAN128/RzZHOFo1Vks=.jpg><br/>
<label>RzZHOFo1Vks=</label><br/>
</td>
<td><input type='checkbox'><br/><label></label><br/></td>
</tr>
<tr style='page-break-inside:avoid;'>
<td>
<img src=http://localhost:53358/resources/Images/EAN128/VUhHOVVZVks=.jpg><br/>
<label>VUhHOVVZVks=</label><br/>
</td>
<td><input type='checkbox'><br/><label></label><br/></td>
</tr>
<tr style='page-break-inside:avoid;'>
<td>
<img src=http://localhost:53358/resources/Images/EAN128/VThWUTdLVks=.jpg><br/>
<label>VThWUTdLVks=</label><br/>
</td>
<td><input type='checkbox'><br/><label></label><br/></td>
</tr>
<tr style='page-break-inside:avoid;'>
<td>
<img src=http://localhost:53358/resources/Images/EAN128/R05YQlNDVks=.jpg><br/>
<label>R05YQlNDVks=</label><br/>
</td>
<td><input type='checkbox'><br/><label></label><br/></td>
</tr>
<tr style='page-break-inside:avoid;'>
<td>
<img src=http://localhost:53358/resources/Images/EAN128/OVQyU1c3Vks=.jpg><br/>
<label>OVQyU1c3Vks=</label><br/>
</td>
<td><input type='checkbox'><br/><label></label><br/></td>
</tr>
<tr style='page-break-inside:avoid;'>
<td>
<img src=http://localhost:53358/resources/Images/EAN128/TTlHUkVOVks=.jpg><br/>
<label>TTlHUkVOVks=</label><br/>
</td>
<td><input type='checkbox'><br/><label></label><br/></td>
</tr>
<tr style='page-break-inside:avoid;'>
<td>
<img src=http://localhost:53358/resources/Images/EAN128/OUtSNUQ2Vks=.jpg><br/>
<label>OUtSNUQ2Vks=</label><br/>
</td>
<td><input type='checkbox'><br/><label></label><br/></td>
</tr>
<tr style='page-break-inside:avoid;'>
<td>
<img src=http://localhost:53358/resources/Images/EAN128/OENQMkNaVks=.jpg><br/>
<label>OENQMkNaVks=</label><br/>
</td>
<td><input type='checkbox'><br/><label></label><br/></td>
</tr>
<tr style='page-break-inside:avoid;'>
<td>
<img src=http://localhost:53358/resources/Images/EAN128/Q1o2Qjc3Vks=.jpg><br/>
<label>Q1o2Qjc3Vks=</label><br/>
</td>
<td><input type='checkbox'><br/><label></label><br/></td>
</tr>
<tr style='page-break-inside:avoid;'>
<td>
<img src=http://localhost:53358/resources/Images/EAN128/V0xNOVJBVks=.jpg><br/>
<label>V0xNOVJBVks=</label><br/>
</td>
<td><input type='checkbox'><br/><label></label><br/></td>
</tr>
<tr style='page-break-inside:avoid;'>
<td>
<img src=http://localhost:53358/resources/Images/EAN128/TjRMOVdBVks=.jpg><br/>
<label>TjRMOVdBVks=</label><br/>
</td>
<td><input type='checkbox'><br/><label></label><br/></td>
</tr>
<tr style='page-break-inside:avoid;'>
<td rowspan='2'><label>Večerja na zajli</label></td>
<td>
<img src=http://localhost:53358/resources/Images/EAN128/Rk5SRFdWVlo=.jpg><br/>
<label>Rk5SRFdWVlo=</label><br/>
</td>
<td><input type='checkbox'><br/><label></label><br/></td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='2'>2,00</td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='2'>KOM</td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='2'>91,56 €</td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='2'>183,12 €</td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='2'>22,00 %</td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='2'>40,29 €</td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='2'>223,41 €</td>
</tr>
<tr style='page-break-inside:avoid;'>
<td>
<img src=http://localhost:53358/resources/Images/EAN128/OEI4V0FSVlo=.jpg><br/>
<label>OEI4V0FSVlo=</label><br/>
</td>
<td><input type='checkbox'><br/><label></label><br/></td>
</tr>
<tr style='page-break-inside:avoid;'>
<td rowspan='10'><label>Za moške, ki mislijo da kosilo pade z neba</label></td>
<td>
<img src=http://localhost:53358/resources/Images/EAN128/VVpETFhUWk0=.jpg><br/>
<label>VVpETFhUWk0=</label><br/>
</td>
<td><input type='checkbox'><br/><label></label><br/></td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='10'>10,00</td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='10'>KOM</td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='10'>32,34 €</td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='10'>323,40 €</td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='10'>22,00 %</td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='10'>71,15 €</td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='10'>394,55 €</td>
</tr>
<tr style='page-break-inside:avoid;'>
<td>
<img src=http://localhost:53358/resources/Images/EAN128/OUJXREo5Wk0=.jpg><br/>
<label>OUJXREo5Wk0=</label><br/>
</td>
<td><input type='checkbox'><br/><label></label><br/></td>
</tr>
<tr style='page-break-inside:avoid;'>
<td>
<img src=http://localhost:53358/resources/Images/EAN128/TlA4OVU1Wk0=.jpg><br/>
<label>TlA4OVU1Wk0=</label><br/>
</td>
<td><input type='checkbox'><br/><label></label><br/></td>
</tr>
<tr style='page-break-inside:avoid;'>
<td>
<img src=http://localhost:53358/resources/Images/EAN128/NlRTOFRQWk0=.jpg><br/>
<label>NlRTOFRQWk0=</label><br/>
</td>
<td><input type='checkbox'><br/><label></label><br/></td>
</tr>
<tr style='page-break-inside:avoid;'>
<td>
<img src=http://localhost:53358/resources/Images/EAN128/VVRQVTRSWk0=.jpg><br/>
<label>VVRQVTRSWk0=</label><br/>
</td>
<td><input type='checkbox'><br/><label></label><br/></td>
</tr>
<tr style='page-break-inside:avoid;'>
<td>
<img src=http://localhost:53358/resources/Images/EAN128/WEEzUzZCWk0=.jpg><br/>
<label>WEEzUzZCWk0=</label><br/>
</td>
<td><input type='checkbox'><br/><label></label><br/></td>
</tr>
<tr style='page-break-inside:avoid;'>
<td>
<img src=http://localhost:53358/resources/Images/EAN128/TVZWUkVNWk0=.jpg><br/>
<label>TVZWUkVNWk0=</label><br/>
</td>
<td><input type='checkbox'><br/><label></label><br/></td>
</tr>
<tr style='page-break-inside:avoid;'>
<td>
<img src=http://localhost:53358/resources/Images/EAN128/RDlGVTVOWk0=.jpg><br/>
<label>RDlGVTVOWk0=</label><br/>
</td>
<td><input type='checkbox'><br/><label></label><br/></td>
</tr>
<tr style='page-break-inside:avoid;'>
<td>
<img src=http://localhost:53358/resources/Images/EAN128/TFBBR1pTWk0=.jpg><br/>
<label>TFBBR1pTWk0=</label><br/>
</td>
<td><input type='checkbox'><br/><label></label><br/></td>
</tr>
<tr style='page-break-inside:avoid;'>
<td>
<img src=http://localhost:53358/resources/Images/EAN128/QkVYQ1ZKWk0=.jpg><br/>
<label>QkVYQ1ZKWk0=</label><br/>
</td>
<td><input type='checkbox'><br/><label></label><br/></td>
</tr>
</tbody>
</table><br/>
<div style='page-break-inside:avoid;margin-bottom: 30px;'>
<label style='position:relative;left:0;font-size:12px;'>Specifikacija obračunanega davka, dokumenta št.:</label><br/>
<div id='divBottom' style='position:relative;width:100%;min-height:160px;'>
<table id='tblLeft'>
<th>Stopnja</th><th>Osnova za DDV</th><th>Znesek DDV</th><th>Vrednost z DDV</th>
<tr>
<td>9,5 %</td><td>0,00 €</td><td>0,00 €</td><td>0,00 €</td>
</tr><tr>
<td>22 %</td><td>1359,22 €</td><td>299,03 €</td><td>1658,25 €</td>
</tr>
</table>
<table id='tblRight'>
<tr style='border-bottom:1px solid black !important;'>
<td style='text-align:left;'><b>Skupaj brez DDV:</b></td><td style='text-align:right;'>1359,22 €</td>
</tr>
<tr>
<td style='text-align:left;'><b>Osnova za DDV</b></td><td style='text-align:right;'>1359,22 €</td>
</tr>
<tr style='border-bottom:1px solid black !important;'>
<td style='text-align:left;'><b>DDV:</b></td><td style='text-align:right;'>299,03 €</td>
</tr>
</table>
<label style='position:absolute;right:80px;bottom:20px;'><b>SKUPAJ:</b></label>
<label style='position:absolute;right:0;bottom:20px;'><b>1658,25 €</b></label>
</div></div><br/><br/><br/>
&#13;
&#13;
&#13;

2 个答案:

答案 0 :(得分:3)

page-break-inside

没有任何问题

表格应如下所示适用于page-break-inside

<tr style='page-break-inside:avoid;'>
 <td ><label>Mali kuharski mojster</label></td>
 <td class="td">
    <table >
        <tbody>
            <tr> 
                <td>
                    <img src=http://localhost:53358/resources/Images/EAN128/VFdNNE5TIE1L.jpg><br/>
                    <label>VFdNNE5TIE1L</label><br/>
                </td>   
                <td><input type='checkbox'><br/><label></label><br/></td>
            </tr>       
            <tr>
                <td>
                    <img src=http://localhost:53358/resources/Images/EAN128/VjJUOEVaIE1L.jpg><br/>
                    <label>VjJUOEVaIE1L</label><br/>
                </td>
                <td><input type='checkbox'><br/><label></label><br/></td>
            </tr>
        </tbody>
    </table>            
 </td>
 <td style='overflow: hidden; white-space: nowrap;' >2,00</td>
 <td style='overflow: hidden; white-space: nowrap;' >KOM</td>
 <td style='overflow: hidden; white-space: nowrap;' >32,21 €</td>
 <td style='overflow: hidden; white-space: nowrap;' >64,42 €</td>
 <td style='overflow: hidden; white-space: nowrap;' >22,00 %</td>
 <td style='overflow: hidden; white-space: nowrap;' >14,17 €</td>
 <td style='overflow: hidden; white-space: nowrap;' >78,59 €</td>

而不是

<tr style='page-break-inside:avoid;'>
    <td rowspan='2'><label>Mali kuharski mojster</label></td>
    <td>
        <img src=http://localhost:53358/resources/Images/EAN128/VFdNNE5TIE1L.jpg><br/>
        <label>VFdNNE5TIE1L</label><br/>
    </td>
    <td><input type='checkbox'><br/><label></label><br/></td>
    <td style='overflow: hidden; white-space: nowrap;' rowspan='2'>2,00</td>
    <td style='overflow: hidden; white-space: nowrap;' rowspan='2'>KOM</td>
    <td style='overflow: hidden; white-space: nowrap;' rowspan='2'>32,21 €</td>
    <td style='overflow: hidden; white-space: nowrap;' rowspan='2'>64,42 €</td>
    <td style='overflow: hidden; white-space: nowrap;' rowspan='2'>22,00 %</td>
    <td style='overflow: hidden; white-space: nowrap;' rowspan='2'>14,17 €</td>
    <td style='overflow: hidden; white-space: nowrap;' rowspan='2'>78,59 €</td>
</tr>
<tr style='page-break-inside:avoid;'>
    <td>
        <img src=http://localhost:53358/resources/Images/EAN128/VjJUOEVaIE1L.jpg><br/>
        <label>VjJUOEVaIE1L</label><br/>
    </td>
    <td><input type='checkbox'><br/><label></label><br/></td>
</tr>

重组整个html

<style>#tblArticles{font-size: 12px !important; font-family: verdana, sans-serif; border-collapse: collapse; width: 100%;}
   #tblArticles td{border: 1px solid black;text-align: center;padding: 8px;}
   #tblArticles th {border: 1px solid black;text-align: center;padding: 8px;background-color: #dddddd;}
</style>
<style>#tblLeft{position:absolute;left:0; font-size: 10px !important; font-family: verdana, sans-serif;border-collapse:collapse; width:40%;}
   #tblLeft td{font-size: 10px !important; border: 1px solid black;text-align: center;padding: 8px;}
   #tblLeft th {font-size: 10px !important; border: 1px solid black;text-align: center;padding: 8px;background-color: #dddddd;}
</style>
<style>#tblRight{position:absolute;right:0; font-size: 10px !important; font-family: verdana, sans-serif;border-collapse:collapse; width:20%;}
   #tblRight td{font-size: 10px !important; text-align: center;padding: 8px;}
</style>
<style>
    #tblArticles td.td{
        padding: 0px;
    }

    #tblArticles td.td table {
        width: 100%;
    }

    #tblArticles td.td table td{
        border: 0px;
        border-bottom: 1px solid black;
    }


    #tblArticles td.td table tr:last-child td{
        border-bottom: 0px;
        border-top: 0px;
    }

    #tblArticles th.th {
        padding: 0px;   
    }

    #tblArticles th.th table {  
        padding: 0px;
        width: 100%;
    }

    #tblArticles th.th table th{
        border: 0px;
    }

    #tblArticles th.th table th:first-child{
        width: 70%;
        border-right: 1px solid black;
    }

    #tblArticles td.td table tr td:first-child{
        width: 70%;
        border-right: 1px solid black;
    }
</style>
<table id='tblArticles'>
   <thead>
      <th>Vrsta blaga/storitve</th>
      <th class="th"><table><thead><th>Interna številka</th><th>Prodana koda</th></thead></table></th>
      <th>Količina</th>
      <th>EnM</th>
      <th>Cena brez DDV</th>
      <th>Vrednost brez DDV</th>
      <th>DDV</th>
      <th>Znesek DDV</th>
      <th>Vrednost z DDV</th>
   </thead>
   <tfoot>
      <tr style='visibility:hidden;'>
         <td></td>
      </tr>
      <tr style='visibility:hidden;'>
         <td></td>
      </tr>
      <tr style='visibility:hidden;'>
         <td></td>
      </tr>
   </tfoot>
   <tbody style='page-break-inside:avoid;'>
      <tr style='page-break-inside:avoid;'>
         <td ><label>Mali kuharski mojster</label></td>
         <td class="td">
            <table >
                <tbody>
                    <tr> 
                        <td>
                            <img src=http://localhost:53358/resources/Images/EAN128/VFdNNE5TIE1L.jpg><br/>
                            <label>VFdNNE5TIE1L</label><br/>
                        </td>   
                        <td><input type='checkbox'><br/><label></label><br/></td>
                    </tr>       
                    <tr>
                        <td>
                            <img src=http://localhost:53358/resources/Images/EAN128/VjJUOEVaIE1L.jpg><br/>
                            <label>VjJUOEVaIE1L</label><br/>
                        </td>
                        <td><input type='checkbox'><br/><label></label><br/></td>
                    </tr>
                </tbody>
            </table>            
         </td>
         <td style='overflow: hidden; white-space: nowrap;' >2,00</td>
         <td style='overflow: hidden; white-space: nowrap;' >KOM</td>
         <td style='overflow: hidden; white-space: nowrap;' >32,21 €</td>
         <td style='overflow: hidden; white-space: nowrap;' >64,42 €</td>
         <td style='overflow: hidden; white-space: nowrap;' >22,00 %</td>
         <td style='overflow: hidden; white-space: nowrap;' >14,17 €</td>
         <td style='overflow: hidden; white-space: nowrap;' >78,59 €</td>
      </tr>
      <tr style='page-break-inside:avoid;'>
         <td ><label>Veliki kuharski mojster</label></td>
         <td class="td">
            <table >
                <tbody>
                    <tr> 
                        <td>
                            <img src=http://localhost:53358/resources/Images/EAN128/NFA1SFFKVks=.jpg><br/>
                            <label>NFA1SFFKVks=</label><br/>
                        </td>   
                        <td><input type='checkbox'><br/><label></label><br/></td>
                    </tr>       
                    <tr>
                        <td>
                            <img src=http://localhost:53358/resources/Images/EAN128/RzZHOFo1Vks=.jpg><br/>
                            <label>RzZHOFo1Vks=</label><br/>
                        </td>
                        <td><input type='checkbox'><br/><label></label><br/></td>
                    </tr>
                    <tr>
                        <td>
                            <img src=http://localhost:53358/resources/Images/EAN128/VUhHOVVZVks=.jpg><br/>
                            <label>VUhHOVVZVks=</label><br/>
                         </td>
                         <td><input type='checkbox'><br/><label></label><br/></td>
                    </tr>
                     <tr >
                         <td>
                            <img src=http://localhost:53358/resources/Images/EAN128/VThWUTdLVks=.jpg><br/>
                            <label>VThWUTdLVks=</label><br/>
                         </td>
                         <td><input type='checkbox'><br/><label></label><br/></td>
                      </tr>
                      <tr>
                         <td>
                            <img src=http://localhost:53358/resources/Images/EAN128/VThWUTdLVks=.jpg><br/>
                            <label>VThWUTdLVks=</label><br/>
                         </td>
                         <td><input type='checkbox'><br/><label></label><br/></td>
                      </tr>
                      <tr>
                         <td>
                            <img src=http://localhost:53358/resources/Images/EAN128/R05YQlNDVks=.jpg><br/>
                            <label>R05YQlNDVks=</label><br/>
                         </td>
                         <td><input type='checkbox'><br/><label></label><br/></td>
                      </tr>
                      <tr>
                         <td>
                            <img src=http://localhost:53358/resources/Images/EAN128/OVQyU1c3Vks=.jpg><br/>
                            <label>OVQyU1c3Vks=</label><br/>
                         </td>
                         <td><input type='checkbox'><br/><label></label><br/></td>
                      </tr>
                    <tr style='page-break-inside:avoid;'>
                         <td>
                            <img src=http://localhost:53358/resources/Images/EAN128/TTlHUkVOVks=.jpg><br/>
                            <label>TTlHUkVOVks=</label><br/>
                         </td>
                         <td><input type='checkbox'><br/><label></label><br/></td>
                      </tr>
                      <tr style='page-break-inside:avoid;'>
                         <td>
                            <img src=http://localhost:53358/resources/Images/EAN128/OUtSNUQ2Vks=.jpg><br/>
                            <label>OUtSNUQ2Vks=</label><br/>
                         </td>
                         <td><input type='checkbox'><br/><label></label><br/></td>
                      </tr>
                      <tr style='page-break-inside:avoid;'>
                         <td>
                            <img src=http://localhost:53358/resources/Images/EAN128/OENQMkNaVks=.jpg><br/>
                            <label>OENQMkNaVks=</label><br/>
                         </td>
                         <td><input type='checkbox'><br/><label></label><br/></td>
                      </tr>
                      <tr style='page-break-inside:avoid;'>
                         <td>
                            <img src=http://localhost:53358/resources/Images/EAN128/Q1o2Qjc3Vks=.jpg><br/>
                            <label>Q1o2Qjc3Vks=</label><br/>
                         </td>
                         <td><input type='checkbox'><br/><label></label><br/></td>
                      </tr>
                      <tr style='page-break-inside:avoid;'>
                         <td>
                            <img src=http://localhost:53358/resources/Images/EAN128/V0xNOVJBVks=.jpg><br/>
                            <label>V0xNOVJBVks=</label><br/>
                         </td>
                         <td><input type='checkbox'><br/><label></label><br/></td>
                      </tr>
                      <tr style='page-break-inside:avoid;'>
                         <td>
                            <img src=http://localhost:53358/resources/Images/EAN128/TjRMOVdBVks=.jpg><br/>
                            <label>TjRMOVdBVks=</label><br/>
                         </td>
                         <td><input type='checkbox'><br/><label></label><br/></td>
                      </tr>
                </tbody>
            </table>            
         </td>
         <td style='overflow: hidden; white-space: nowrap;' >12,00</td>
         <td style='overflow: hidden; white-space: nowrap;' >KOM</td>
         <td style='overflow: hidden; white-space: nowrap;' >65,69 €</td>
         <td style='overflow: hidden; white-space: nowrap;' >788,28 €</td>
         <td style='overflow: hidden; white-space: nowrap;' >22,00 %</td>
         <td style='overflow: hidden; white-space: nowrap;' >173,42 €</td>
         <td style='overflow: hidden; white-space: nowrap;' >961,70 €</td>
      </tr>





      <tr style='page-break-inside:avoid;'>
         <td ><label>Večerja na zajli</label></td>
         <td class="td">
            <table >
                <tbody>
                    <tr> 
                        <td>
                            <img src=http://localhost:53358/resources/Images/EAN128/Rk5SRFdWVlo=.jpg><br/>
                            <label>Rk5SRFdWVlo=</label><br/>
                        </td>   
                        <td><input type='checkbox'><br/><label></label><br/></td>
                    </tr>       
                    <tr>
                        <td>
                            <img src=http://localhost:53358/resources/Images/EAN128/OEI4V0FSVlo=.jpg><br/>
                            <label>OEI4V0FSVlo=</label><br/>
                        </td>
                        <td><input type='checkbox'><br/><label></label><br/></td>
                    </tr>
                </tbody>
            </table>            
         </td>
         <td style='overflow: hidden; white-space: nowrap;' >2,00</td>
         <td style='overflow: hidden; white-space: nowrap;' >KOM</td>
         <td style='overflow: hidden; white-space: nowrap;' >91,56 €</td>
         <td style='overflow: hidden; white-space: nowrap;' >183,12 €</td>
         <td style='overflow: hidden; white-space: nowrap;' >22,00 %</td>
         <td style='overflow: hidden; white-space: nowrap;' >40,29 €</td>
         <td style='overflow: hidden; white-space: nowrap;' >223,41 €</td>
      </tr>
      <tr style='page-break-inside:avoid;'>
         <td ><label>Za moške, ki mislijo da kosilo pade z neba</label></td>
         <td class="td">
            <table >
                <tbody>
                    <tr> 
                        <td>
                            <img src=http://localhost:53358/resources/Images/EAN128/VVpETFhUWk0=.jpg><br/>
                            <label>VVpETFhUWk0=</label><br/>
                        </td>   
                        <td><input type='checkbox'><br/><label></label><br/></td>
                    </tr>       
                    <tr>
                        <td>
                            <img src=http://localhost:53358/resources/Images/EAN128/OUJXREo5Wk0=.jpg><br/>
                            <label>OUJXREo5Wk0=</label><br/>
                        </td>
                        <td><input type='checkbox'><br/><label></label><br/></td>
                    </tr>
                    <tr>
                         <td>
                            <img src=http://localhost:53358/resources/Images/EAN128/TlA4OVU1Wk0=.jpg><br/>
                            <label>TlA4OVU1Wk0=</label><br/>
                         </td>
                         <td><input type='checkbox'><br/><label></label><br/></td>
                    </tr>   
                  <tr>
                     <td>
                        <img src=http://localhost:53358/resources/Images/EAN128/TlA4OVU1Wk0=.jpg><br/>
                        <label>TlA4OVU1Wk0=</label><br/>
                     </td>
                     <td><input type='checkbox'><br/><label></label><br/></td>
                  </tr>         
                  <tr>
                     <td>
                        <img src=http://localhost:53358/resources/Images/EAN128/NlRTOFRQWk0=.jpg><br/>
                        <label>NlRTOFRQWk0=</label><br/>
                     </td>
                     <td><input type='checkbox'><br/><label></label><br/></td>
                  </tr>         

                  <tr>
                     <td>
                        <img src=http://localhost:53358/resources/Images/EAN128/VVRQVTRSWk0=.jpg><br/>
                        <label>VVRQVTRSWk0=</label><br/>
                     </td>
                     <td><input type='checkbox'><br/><label></label><br/></td>
                  </tr>
                  <tr>
                     <td>
                        <img src=http://localhost:53358/resources/Images/EAN128/WEEzUzZCWk0=.jpg><br/>
                        <label>WEEzUzZCWk0=</label><br/>
                     </td>
                     <td><input type='checkbox'><br/><label></label><br/></td>
                  </tr>
                  <tr>
                     <td>
                        <img src=http://localhost:53358/resources/Images/EAN128/TVZWUkVNWk0=.jpg><br/>
                        <label>TVZWUkVNWk0=</label><br/>
                     </td>
                     <td><input type='checkbox'><br/><label></label><br/></td>
                  </tr>
                  <tr>
                     <td>
                        <img src=http://localhost:53358/resources/Images/EAN128/RDlGVTVOWk0=.jpg><br/>
                        <label>RDlGVTVOWk0=</label><br/>
                     </td>
                     <td><input type='checkbox'><br/><label></label><br/></td>
                  </tr>
                  <tr>
                     <td>
                        <img src=http://localhost:53358/resources/Images/EAN128/TFBBR1pTWk0=.jpg><br/>
                        <label>TFBBR1pTWk0=</label><br/>
                     </td>
                     <td><input type='checkbox'><br/><label></label><br/></td>
                  </tr>
                  <tr>
                     <td>
                        <img src=http://localhost:53358/resources/Images/EAN128/QkVYQ1ZKWk0=.jpg><br/>
                        <label>QkVYQ1ZKWk0=</label><br/>
                     </td>
                     <td><input type='checkbox'><br/><label></label><br/></td>
                  </tr>               
                </tbody>
            </table>
        </td>
         <td style='overflow: hidden; white-space: nowrap;' >10,00</td>
         <td style='overflow: hidden; white-space: nowrap;' >KOM</td>
         <td style='overflow: hidden; white-space: nowrap;' >32,34 €</td>
         <td style='overflow: hidden; white-space: nowrap;' >323,40 €</td>
         <td style='overflow: hidden; white-space: nowrap;' >22,00 %</td>
         <td style='overflow: hidden; white-space: nowrap;' >71,15 €</td>
         <td style='overflow: hidden; white-space: nowrap;' >394,55 €</td>
      </tr>



   </tbody>
</table>
<br/>
<div style='page-break-inside:avoid;margin-bottom: 30px;'>
   <label style='position:relative;left:0;font-size:12px;'>Specifikacija obračunanega davka, dokumenta št.:</label><br/>
   <div id='divBottom' style='position:relative;width:100%;min-height:160px;'>
      <table id='tblLeft'>
         <th>Stopnja</th>
         <th>Osnova za DDV</th>
         <th>Znesek DDV</th>
         <th>Vrednost z DDV</th>
         <tr>
            <td>9,5 %</td>
            <td>0,00 €</td>
            <td>0,00 €</td>
            <td>0,00 €</td>
         </tr>
         <tr>
            <td>22 %</td>
            <td>1359,22 €</td>
            <td>299,03 €</td>
            <td>1658,25 €</td>
         </tr>
      </table>
      <table id='tblRight'>
         <tr style='border-bottom:1px solid black !important;'>
            <td style='text-align:left;'><b>Skupaj brez DDV:</b></td>
            <td style='text-align:right;'>1359,22 €</td>
         </tr>
         <tr>
            <td style='text-align:left;'><b>Osnova za DDV</b></td>
            <td style='text-align:right;'>1359,22 €</td>
         </tr>
         <tr style='border-bottom:1px solid black !important;'>
            <td style='text-align:left;'><b>DDV:</b></td>
            <td style='text-align:right;'>299,03 €</td>
         </tr>
      </table>
      <label style='position:absolute;right:80px;bottom:20px;'><b>SKUPAJ:</b></label>
      <label style='position:absolute;right:0;bottom:20px;'><b>1658,25 €</b></label>
   </div>
</div>
<br/><br/><br/>

这不是完整的解决方案,它给你一个想法,还有css问题

答案 1 :(得分:1)

page-break-inside:avoid;没有任何问题,但这种错误源于视觉思维!

我们认为在使用rowspan时,表结构中只有一行,而不是真的。行架构保持原样,只隐藏。这就是为什么你认为它在打印时会破坏内部的原因,而事实是page-break-inside:avoid;工作得很好而且工作正常。只隐藏了一些边框。

即使您可以在新设计中继续page-break-inside:avoid;,但最好通过在行[page-break-before]之前/之后断开来强制分离。

因此,请将您的表格设计从rowspan方法更改为inner/nested tables,然后删除所有内联page-break规则&amp;只需在<style>...</style>

中添加此内容即可
#tblArticles tr{
   page-break-before: always;
}

&#13;
&#13;
            #tblArticles{
                font-size: 12px !important;
                font-family: verdana, sans-serif;
                border-collapse: collapse;
                width: 100%;
            }
            #tblArticles tr{
                page-break-before: always;
            }
            #tblArticles td{
                border: 1px solid black;
                text-align: center;
                /*padding: 8px;*/
                padding: 0;
                margin: 0;
               
            }
            #tblArticles table.inner{
                width: 100%;
                margin: 0;
            }
            #tblArticles table.inner td{
                padding: 0;
                width: 50%;
                margin: 0;
                padding: 0;
                border: 0;
            }
             #tblArticles table.inner tr td{
                border-bottom: 1px solid black;
            }
            #tblArticles table.inner tr:last-child td{
                border-bottom: none;
            }
            #tblArticles th {
                border: 1px solid black;
                text-align: center;
                padding: 8px;
                background-color: #dddddd;
            }
            #tblLeft{
                position:absolute;
                left:0;
                font-size: 10px !important;
                font-family: verdana, sans-serif;
                border-collapse:collapse;
                width:40%;
            }
            #tblLeft td{
                font-size: 10px !important;
                border: 1px solid black;
                text-align: center;
                padding: 8px;
            }
            #tblLeft th {
                font-size: 10px !important; 
                border: 1px solid black;
                text-align: center;
                padding: 8px;
                background-color: #dddddd;
            }
            #tblRight{
                position:absolute;
                right:0;
                font-size: 10px !important; 
                font-family: verdana, sans-serif;
                border-collapse:collapse; 
                width:20%;
            }
            #tblRight td{
                font-size: 10px !important; 
                text-align: center;
                padding: 8px;
            }
        
&#13;
        <table id='tblArticles'>
            <thead>
                <tr>
                    <th>Vrsta blaga/storitve</th>
                    <th>Interna številka</th>
                    <th>Prodana koda</th>
                    <th>Količina</th>
                    <th>EnM</th>
                    <th>Cena brez DDV</th>
                    <th>Vrednost brez DDV</th>
                    <th>DDV</th>
                    <th>Znesek DDV</th>
                    <th>Vrednost z DDV</th>
                </tr>
            </thead>
            <tfoot>
                <tr style='visibility:hidden;'><td></td></tr>
                <tr style='visibility:hidden;'><td></td></tr>
                <tr style='visibility:hidden;'><td></td></tr>
                <tr style='visibility:hidden;'><td></td></tr>
                <tr style='visibility:hidden;'><td></td></tr>
                <tr style='visibility:hidden;'><td></td></tr>
                <tr style='visibility:hidden;'><td></td></tr>
                <tr style='visibility:hidden;'><td></td></tr>
                <tr style='visibility:hidden;'><td></td></tr>
                <tr style='visibility:hidden;'><td></td></tr>
            </tfoot>
            <tbody>
                <tr>
                    <td><label>Mali kuharski mojster</label></td>
                    <td colspan="2">
                        <table class="inner">
                            <tr>
                                <td>
                                    <img src="http://localhost:53358/resources/Images/EAN128/VFdNNE5TIE1L.jpg" /><br/>
                                    <label>VFdNNE5TIE1L</label><br/>
                                </td>
                                <td><input type='checkbox'><br/><label></label><br/></td>
                            </tr>
                            <tr>
                                <td>
                                    <img src="http://localhost:53358/resources/Images/EAN128/VjJUOEVaIE1L.jpg" /><br/>
                                    <label>VjJUOEVaIE1L</label><br/>
                                </td>
                                <td><input type='checkbox'><br/><label></label><br/></td>
                            </tr>
                        </table>
                    </td>
                    <td style='overflow: hidden; white-space: nowrap;'>2,00</td>
                    <td style='overflow: hidden; white-space: nowrap;'>KOM</td>
                    <td style='overflow: hidden; white-space: nowrap;'>32,21 €</td>
                    <td style='overflow: hidden; white-space: nowrap;'>64,42 €</td>
                    <td style='overflow: hidden; white-space: nowrap;'>22,00 %</td>
                    <td style='overflow: hidden; white-space: nowrap;'>14,17 €</td>
                    <td style='overflow: hidden; white-space: nowrap;'>78,59 €</td>
                </tr>
                <tr>
                    <td><label>Veliki kuharski mojster</label></td>
                    <td colspan="2">
                        <table  class="inner">
                            <tr>
                                <td>
                                    <img src="http://localhost:53358/resources/Images/EAN128/NFA1SFFKVks=.jpg" /><br/>
                                    <label>NFA1SFFKVks=</label><br/>
                                </td>
                                <td><input type='checkbox'><br/><label></label><br/></td>
                            </tr>
                            <tr>
                                <td>
                                    <img src="http://localhost:53358/resources/Images/EAN128/RzZHOFo1Vks=.jpg" /><br/>
                                    <label>RzZHOFo1Vks=</label><br/>
                                </td>
                                <td><input type='checkbox'><br/><label></label><br/></td>
                            </tr>
                            <tr>
                                <td>
                                    <img src="http://localhost:53358/resources/Images/EAN128/VUhHOVVZVks=.jpg" /><br/>
                                    <label>VUhHOVVZVks=</label><br/>
                                </td>
                                <td><input type='checkbox'><br/><label></label><br/></td>
                            </tr>
                            <tr>
                                <td>
                                    <img src="http://localhost:53358/resources/Images/EAN128/VThWUTdLVks=.jpg" /><br/>
                                    <label>VThWUTdLVks=</label><br/>
                                </td>
                                <td><input type='checkbox'><br/><label></label><br/></td>
                            </tr>
                            <tr>
                                <td>
                                    <img src="http://localhost:53358/resources/Images/EAN128/R05YQlNDVks=.jpg" /><br/>
                                    <label>R05YQlNDVks=</label><br/>
                                </td>
                                <td><input type='checkbox'><br/><label></label><br/></td>
                            </tr>
                            <tr>
                                <td>
                                    <img src="http://localhost:53358/resources/Images/EAN128/OVQyU1c3Vks=.jpg" /><br/>
                                    <label>OVQyU1c3Vks=</label><br/>
                                </td>
                                <td><input type='checkbox'><br/><label></label><br/></td>
                            </tr>
                            <tr>
                                <td>
                                    <img src="http://localhost:53358/resources/Images/EAN128/TTlHUkVOVks=.jpg" /><br/>
                                    <label>TTlHUkVOVks=</label><br/>
                                </td>
                                <td><input type='checkbox'><br/><label></label><br/></td>
                            </tr>
                            <tr>
                                <td>
                                    <img src="http://localhost:53358/resources/Images/EAN128/OUtSNUQ2Vks=.jpg" /><br/>
                                    <label>OUtSNUQ2Vks=</label><br/>
                                </td>
                                <td><input type='checkbox'><br/><label></label><br/></td>
                            </tr>
                            <tr>
                                <td>
                                    <img src="http://localhost:53358/resources/Images/EAN128/OENQMkNaVks=.jpg" /><br/>
                                    <label>OENQMkNaVks=</label><br/>
                                </td>
                                <td><input type='checkbox'><br/><label></label><br/></td>
                            </tr>
                            <tr>
                                <td>
                                    <img src="http://localhost:53358/resources/Images/EAN128/Q1o2Qjc3Vks=.jpg" /><br/>
                                    <label>Q1o2Qjc3Vks=</label><br/>
                                </td>
                                <td><input type='checkbox'><br/><label></label><br/></td>
                            </tr>
                            <tr>
                                <td>
                                    <img src="http://localhost:53358/resources/Images/EAN128/V0xNOVJBVks=.jpg" /><br/>
                                    <label>V0xNOVJBVks=</label><br/>
                                </td>
                                <td><input type='checkbox'><br/><label></label><br/></td>
                            </tr>
                            <tr>
                                <td>
                                    <img src="http://localhost:53358/resources/Images/EAN128/TjRMOVdBVks=.jpg" /><br/>
                                    <label>TjRMOVdBVks=</label><br/>
                                </td>
                                <td><input type='checkbox'><br/><label></label><br/></td>
                            </tr>
                        </table>
                    </td>
                    <td style='overflow: hidden; white-space: nowrap;'>12,00</td>
                    <td style='overflow: hidden; white-space: nowrap;'>KOM</td>
                    <td style='overflow: hidden; white-space: nowrap;'>65,69 €</td>
                    <td style='overflow: hidden; white-space: nowrap;'>788,28 €</td>
                    <td style='overflow: hidden; white-space: nowrap;'>22,00 %</td>
                    <td style='overflow: hidden; white-space: nowrap;'>173,42 €</td>
                    <td style='overflow: hidden; white-space: nowrap;'>961,70 €</td>
                </tr>
                <tr>
                    <td><label>Večerja na zajli</label></td>
                    <td colspan="2">
                        <table class="inner">
                            <tr>
                                <td>
                                    <img src="http://localhost:53358/resources/Images/EAN128/Rk5SRFdWVlo=.jpg" /><br/>
                                    <label>Rk5SRFdWVlo=</label><br/>
                                </td>
                                <td><input type='checkbox'><br/><label></label><br/></td>
                            </tr>
                            <tr>
                                <td>
                                    <img src="http://localhost:53358/resources/Images/EAN128/OEI4V0FSVlo=.jpg" /><br/>
                                    <label>OEI4V0FSVlo=</label><br/>
                                </td>
                                <td><input type='checkbox'><br/><label></label><br/></td>
                            </tr>
                        </table>
                    </td>
                    <td style='overflow: hidden; white-space: nowrap;'>2,00</td>
                    <td style='overflow: hidden; white-space: nowrap;'>KOM</td>
                    <td style='overflow: hidden; white-space: nowrap;'>91,56 €</td>
                    <td style='overflow: hidden; white-space: nowrap;'>183,12 €</td>
                    <td style='overflow: hidden; white-space: nowrap;'>22,00 %</td>
                    <td style='overflow: hidden; white-space: nowrap;'>40,29 €</td>
                    <td style='overflow: hidden; white-space: nowrap;'>223,41 €</td>
                </tr>
                <tr>
                    <td><label>Za moške, ki mislijo da kosilo pade z neba</label></td>
                    <td colspan="2">
                        <table class="inner">
                            <tr>
                                <td>
                                    <img src="http://localhost:53358/resources/Images/EAN128/VVpETFhUWk0=.jpg" /><br/>
                                    <label>VVpETFhUWk0=</label><br/>
                                </td>
                                <td><input type='checkbox'><br/><label></label><br/></td>
                            </tr>
                            <tr>
                                <td>
                                    <img src="http://localhost:53358/resources/Images/EAN128/OUJXREo5Wk0=.jpg" /><br/>
                                    <label>OUJXREo5Wk0=</label><br/>
                                </td>
                                <td><input type='checkbox'><br/><label></label><br/></td>
                            </tr>
                            <tr>
                                <td>
                                    <img src="http://localhost:53358/resources/Images/EAN128/TlA4OVU1Wk0=.jpg" /><br/>
                                    <label>TlA4OVU1Wk0=</label><br/>
                                </td>
                                <td><input type='checkbox'><br/><label></label><br/></td>
                            </tr>
                            <tr>
                                <td>
                                    <img src="http://localhost:53358/resources/Images/EAN128/NlRTOFRQWk0=.jpg" /><br/>
                                    <label>NlRTOFRQWk0=</label><br/>
                                </td>
                                <td><input type='checkbox'><br/><label></label><br/></td>
                            </tr>
                            <tr>
                                <td>
                                    <img src="http://localhost:53358/resources/Images/EAN128/VVRQVTRSWk0=.jpg" /><br/>
                                    <label>VVRQVTRSWk0=</label><br/>
                                </td>
                                <td><input type='checkbox'><br/><label></label><br/></td>
                            </tr>
                            <tr>
                                <td>
                                    <img src="http://localhost:53358/resources/Images/EAN128/WEEzUzZCWk0=.jpg" /><br/>
                                    <label>WEEzUzZCWk0=</label>
                                </td>
                                <td><input type='checkbox'><br/><label></label><br/></td>
                            </tr>
                            <tr>
                                <td>
                                    <img src="http://localhost:53358/resources/Images/EAN128/TVZWUkVNWk0=.jpg" /><br/>
                                    <label>TVZWUkVNWk0=</label><br/>
                                </td>
                                <td><input type='checkbox'><br/><label></label><br/></td>
                            </tr>
                            <tr>
                                <td>
                                    <img src="http://localhost:53358/resources/Images/EAN128/RDlGVTVOWk0=.jpg" /><br/>
                                    <label>RDlGVTVOWk0=</label><br/>
                                </td>
                                <td><input type='checkbox'><br/><label></label><br/></td>
                            </tr>
                            <tr>
                                <td>
                                    <img src="http://localhost:53358/resources/Images/EAN128/TFBBR1pTWk0=.jpg" /><br/>
                                    <label>TFBBR1pTWk0=</label><br/>
                                </td>
                                <td><input type='checkbox'><br/><label></label><br/></td>
                            </tr>
                            <tr>
                                <td>
                                    <img src="http://localhost:53358/resources/Images/EAN128/QkVYQ1ZKWk0=.jpg" /><br/>
                                    <label>QkVYQ1ZKWk0=</label>
                                </td>
                                <td><input type='checkbox'><br/><label></label><br/></td>
                            </tr>
                        </table>
                    </td>
                    <td style='overflow: hidden; white-space: nowrap;'>10,00</td>
                    <td style='overflow: hidden; white-space: nowrap;'>KOM</td>
                    <td style='overflow: hidden; white-space: nowrap;'>32,34 €</td>
                    <td style='overflow: hidden; white-space: nowrap;'>323,40 €</td>
                    <td style='overflow: hidden; white-space: nowrap;'>22,00 %</td>
                    <td style='overflow: hidden; white-space: nowrap;'>71,15 €</td>
                    <td style='overflow: hidden; white-space: nowrap;'>394,55 €</td>
                </tr>
            </tbody>
        </table>
        <br/>
        <div style='page-break-inside:avoid;margin-bottom: 30px;'>
            <label style='position:relative;left:0;font-size:12px;'>Specifikacija obračunanega davka, dokumenta št.:</label><br/>
            <div id='divBottom' style='position:relative;width:100%;min-height:160px;'>
                <table id='tblLeft'>
                    <th>Stopnja</th><th>Osnova za DDV</th><th>Znesek DDV</th><th>Vrednost z DDV</th>
                    <tr>
                        <td>9,5 %</td><td>0,00 €</td><td>0,00 €</td><td>0,00 €</td>
                    </tr><tr>
                        <td>22 %</td><td>1359,22 €</td><td>299,03 €</td><td>1658,25 €</td>
                    </tr>
                </table>
                <table id='tblRight'>
                    <tr style='border-bottom:1px solid black !important;'>
                        <td style='text-align:left;'><b>Skupaj brez DDV:</b></td><td style='text-align:right;'>1359,22 €</td>
                    </tr>
                    <tr>
                        <td style='text-align:left;'><b>Osnova za DDV</b></td><td style='text-align:right;'>1359,22 €</td>
                    </tr>
                    <tr style='border-bottom:1px solid black !important;'>
                        <td style='text-align:left;'><b>DDV:</b></td><td style='text-align:right;'>299,03 €</td>
                    </tr>
                </table>
                <label style='position:absolute;right:80px;bottom:20px;'><b>SKUPAJ:</b></label>
                <label style='position:absolute;right:0;bottom:20px;'><b>1658,25 €</b></label>
            </div></div>
&#13;
&#13;
&#13;