草庐IT

html - 导出为 PDF 时表格行没有分页符

coder 2023-08-06 原文

当表格导出为 PDF 时,表格行没有分页。我尝试使用以下方法在每个表格行上进行分页:

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

像这样的表格换行符(导出为 PDF - 在浏览器中查看):

我希望表格行“Vrsta blaga/storitve”保持紧凑。因此,单元格不会显示在不可打印区域,如上图所示。这可能吗?我应该使用什么样式?这是我的代码:

<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/>

最佳答案

page-break-inside:avoid;没有问题, 但是错误来自于视觉思维!

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

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

因此,从 rowspan 更改您的表格设计方法论,至 inner/nested tables , 然后删除所有内联 page-break规则 & 只需将其添加到 <style>...</style> :

#tblArticles tr{
   page-break-before: always;
}

            #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;
            }
        
        <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>

关于html - 导出为 PDF 时表格行没有分页符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42478165/

有关html - 导出为 PDF 时表格行没有分页符的更多相关文章

  1. ruby - 使用 ruby​​ 将 HTML 转换为纯文本并维护结构/格式 - 2

    我想将html转换为纯文本。不过,我不想只删除标签,我想智能地保留尽可能多的格式。为插入换行符标签,检测段落并格式化它们等。输入非常简单,通常是格式良好的html(不是整个文档,只是一堆内容,通常没有anchor或图像)。我可以将几个正则表达式放在一起,让我达到80%,但我认为可能有一些现有的解决方案更智能。 最佳答案 首先,不要尝试为此使用正则表达式。很有可能你会想出一个脆弱/脆弱的解决方案,它会随着HTML的变化而崩溃,或者很难管理和维护。您可以使用Nokogiri快速解析HTML并提取文本:require'nokogiri'h

  2. ruby - 难道Lua没有和Ruby的method_missing相媲美的东西吗? - 2

    我好像记得Lua有类似Ruby的method_missing的东西。还是我记错了? 最佳答案 表的metatable的__index和__newindex可以用于与Ruby的method_missing相同的效果。 关于ruby-难道Lua没有和Ruby的method_missing相媲美的东西吗?,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/7732154/

  3. ruby-on-rails - rails 目前在重启后没有安装 - 2

    我有一个奇怪的问题:我在rvm上安装了ruby​​onrails。一切正常,我可以创建项目。但是在我输入“railsnew”时重新启动后,我有“程序'rails'当前未安装。”。SystemUbuntu12.04ruby-v"1.9.3p194"gemlistactionmailer(3.2.5)actionpack(3.2.5)activemodel(3.2.5)activerecord(3.2.5)activeresource(3.2.5)activesupport(3.2.5)arel(3.0.2)builder(3.0.0)bundler(1.1.4)coffee-rails(

  4. ruby-on-rails - Rails HTML 请求渲染 JSON - 2

    在我的Controller中,我通过以下方式在我的index方法中支持HTML和JSON:respond_todo|format|format.htmlformat.json{renderjson:@user}end在浏览器中拉起它时,它会自然地以HTML呈现。但是,当我对/user资源进行内容类型为application/json的curl调用时(因为它是索引方法),我仍然将HTML作为响应。如何获取JSON作为响应?我还需要说明什么? 最佳答案 您应该将.json附加到请求的url,提供的格式在routes.rb的路径中定义。这

  5. ruby - 在没有 sass 引擎的情况下使用 sass 颜色函数 - 2

    我想在一个没有Sass引擎的类中使用Sass颜色函数。我已经在项目中使用了sassgem,所以我认为搭载会像以下一样简单:classRectangleincludeSass::Script::FunctionsdefcolorSass::Script::Color.new([0x82,0x39,0x06])enddefrender#hamlengineexecutedwithcontextofself#sothatwithintemlateicouldcall#%stop{offset:'0%',stop:{color:lighten(color)}}endend更新:参见上面的#re

  6. ruby-on-rails - 使用 Sublime Text 3 突出显示 HTML 背景语法中的 ERB? - 2

    所以我在关注Railscast,我注意到在html.erb文件中,ruby代码有一个微弱的背景高亮效果,以区别于其他代码HTML文档。我知道Ryan使用TextMate。我正在使用SublimeText3。我怎样才能达到同样的效果?谢谢! 最佳答案 为SublimeText安装ERB包。假设您安装了SublimeText包管理器*,只需点击cmd+shift+P即可获得命令菜单,然后键入installpackage并选择PackageControl:InstallPackage获取包管理器菜单。在该菜单中,键入ERB并在看到包时选择

  7. ruby-on-rails - Ruby url 到 html 链接转换 - 2

    我正在使用Rails构建一个简单的聊天应用程序。当用户输入url时,我希望将其输出为html链接(即“url”)。我想知道在Ruby中是否有任何库或众所周知的方法可以做到这一点。如果没有,我有一些不错的正则表达式示例代码可以使用... 最佳答案 查看auto_linkRails提供的辅助方法。这会将所有URL和电子邮件地址变成可点击的链接(htmlanchor标记)。这是文档中的代码示例。auto_link("Gotohttp://www.rubyonrails.organdsayhellotodavid@loudthinking.

  8. ruby-on-rails - Prawn PDF : I need to generate nested tables - 2

    我需要一个表,其中行实际上是2行表,一个嵌套表是..我怎样才能在Prawn中做到这一点?也许我需要延期..但哪一个? 最佳答案 现在支持子表:Prawn::Document.generate("subtable.pdf")do|pdf|subtable=pdf.make_table([["sub"],["table"]])pdf.table([[subtable,"original"]])end 关于ruby-on-rails-PrawnPDF:Ineedtogeneratenested

  9. 没有类的 Ruby 方法? - 2

    大家好!我想知道Ruby中未使用语法ClassName.method_name调用的方法是如何工作的。我头脑中的一些是puts、print、gets、chomp。可以在不使用点运算符的情况下调用这些方法。为什么是这样?他们来自哪里?我怎样才能看到这些方法的完整列表? 最佳答案 Kernel中的所有方法都可用于Object类的所有对象或从Object派生的任何类。您可以使用Kernel.instance_methods列出它们。 关于没有类的Ruby方法?,我们在StackOverflow

  10. ruby-on-rails - Rails 3,嵌套资源,没有路由匹配 [PUT] - 2

    我真的为这个而疯狂。我一直在搜索答案并尝试我找到的所有内容,包括相关问题和stackoverflow上的答案,但仍然无法正常工作。我正在使用嵌套资源,但无法使表单正常工作。我总是遇到错误,例如没有路线匹配[PUT]"/galleries/1/photos"表格在这里:/galleries/1/photos/1/edit路线.rbresources:galleriesdoresources:photosendresources:galleriesresources:photos照片Controller.rbdefnew@gallery=Gallery.find(params[:galle

随机推荐