Anyone know why my table breaking into two parts w...
# advancedpdf
k
Anyone know why my table breaking into two parts when I group items.
b
do you have any freemarker/bfo snippets you can share to help troubleshoot
k
<?xml version="1.0"?><!DOCTYPE pdf PUBLIC "-<//big.faceless.org//report>" "report-1.1.dtd">
<pdf> <head> <link name="NotoSans" type="font" subtype="truetype" src="${nsfont.NotoSans_Regular}" src-bold="${nsfont.NotoSans_Bold}" src-italic="${nsfont.NotoSans_Italic}" src-bolditalic="${nsfont.NotoSans_BoldItalic}" bytes="2" /> <#if .locale == "zh_CN"> <link name="NotoSansCJKsc" type="font" subtype="opentype" src="${nsfont.NotoSansCJKsc_Regular}" src-bold="${nsfont.NotoSansCJKsc_Bold}" bytes="2" /> <#elseif .locale == "zh_TW"> <link name="NotoSansCJKtc" type="font" subtype="opentype" src="${nsfont.NotoSansCJKtc_Regular}" src-bold="${nsfont.NotoSansCJKtc_Bold}" bytes="2" /> <#elseif .locale == "ja_JP"> <link name="NotoSansCJKjp" type="font" subtype="opentype" src="${nsfont.NotoSansCJKjp_Regular}" src-bold="${nsfont.NotoSansCJKjp_Bold}" bytes="2" /> <#elseif .locale == "ko_KR"> <link name="NotoSansCJKkr" type="font" subtype="opentype" src="${nsfont.NotoSansCJKkr_Regular}" src-bold="${nsfont.NotoSansCJKkr_Bold}" bytes="2" /> <#elseif .locale == "th_TH"> <link name="NotoSansThai" type="font" subtype="opentype" src="${nsfont.NotoSansThai_Regular}" src-bold="${nsfont.NotoSansThai_Bold}" bytes="2" /> </#if> <macrolist> <macro id="nlheader"> <table style="width: 100%; font-size: 10pt;"> <tr> <th rowspan="3" style="padding: 10px 6px;"><#if companyInformation.logoUrl?length != 0><img src="${companyInformation.logoUrl}" style="width: 120px; height:45px; float: left;" /> </#if></th> <th rowspan="3" style="font-size: 12pt; padding: 10px 6px;">${companyInformation.companyName}<br />${companyInformation.addressText}</th> <th align="center" colspan="2" style="font-size: 16pt; padding: 10px 6px;">${record@title}</th> </tr> <tr> <th align="center">Start Date:</th> <th align="center">Cancel Date:</th> </tr> <tr> <td align="center" style="padding: 10px 6px;">${record.startdate}</td> <td align="center" style="padding: 10px 6px;">${record.enddate}</td> </tr> </table> </macro> <macro id="nlfooter"> <table class="footer" style="width: 100%; font-size: 8pt;"> <tr> <td align="right" style="padding: 0;"> <pagenumber/> of <totalpages/> </td> </tr> </table> </macro> </macrolist> <style type="text/css">* { <#if .locale == "zh_CN"> font-family: NotoSans, NotoSansCJKsc, sans-serif; <#elseif .locale == "zh_TW"> font-family: NotoSans, NotoSansCJKtc, sans-serif; <#elseif .locale == "ja_JP"> font-family: NotoSans, NotoSansCJKjp, sans-serif; <#elseif .locale == "ko_KR"> font-family: NotoSans, NotoSansCJKkr, sans-serif; <#elseif .locale == "th_TH"> font-family: NotoSans, NotoSansThai, sans-serif; #else font-family: NotoSans, sans-serif; </#if> } table, th, td { border: 0.5px solid black; border-collapse: collapse; } table { font-size: 9pt; page-break-inside:auto } tr { page-break-inside:avoid; page-break-after:auto; } th { font-weight: bold; font-size: 8pt; vertical-align: middle; } th, td { padding: 2px 2px; } thead { background: #395870; color: white; } td p { align:left } </style> </head> <body header="nlheader" header-height="10%" footer="nlfooter" footer-height="20pt" padding="0.5in 0.5in 0.5in 0.5in" size="Letter"> <table style="width: 100%; margin-top: 10px"> <tr> <td colspan="3" style="font-size: 8pt; padding: 6px 2px; font-weight: bold; color: #333333;">${record.billaddress@label}</td> <td colspan="3" style="font-size: 8pt; padding: 6px 2px; font-weight: bold; color: #333333;">${record.shipaddress@label}</td> <td colspan="5" style="font-size: 12pt; background-color: #E3E3E3; font-weight: bold;">${record.total@label?upper_case}</td> </tr> <tr> <td align="center" colspan="3" style="padding: 10px 6px; font-weight: bold;">${record.billaddress}</td> <td align="center" colspan="3" style="padding: 10px 6px; font-weight: bold;">${record.shipaddress}</td> <td align="right" colspan="5" style="font-size: 28pt; padding-top: 20px; background-color: #E3E3E3;">${record.total}</td> </tr> </table> <table style="width: 100%; margin-top:10px"> <tr> <th style="font-size: 8pt; padding: 6px 2px; font-weight: bold; color: #333333;">${record.entity@label}</th> <th style="font-size: 8pt; padding: 6px 2px; font-weight: bold; color: #333333;">${record.paymentmethod@label}</th> <th style="font-size: 8pt; padding: 6px 2px; font-weight: bold; color: #333333;">${record.otherrefnum@label}</th> <th style="font-size: 8pt; padding: 6px 2px; font-weight: bold; color: #333333;">${record.shipmethod@label}</th> <th style="font-size: 8pt; padding: 6px 2px; font-weight: bold; color: #333333;">${record.terms@label}</th> </tr> <tr> <td align="center" style="padding: 10px 6px;">${record.entity}</td> <td align="center" style="padding: 10px 6px;">${record.paymentmethod}</td> <td align="center" style="padding: 10px 6px;">${record.otherrefnum}</td> <td align="center" style="padding: 10px 6px;">${record.shipmethod}</td> <td align="center" style="padding: 10px 6px;">${record.terms}</td> </tr> </table> <#if record.item?has_content> <#macro listGroups items groupField> <#if items?size == 0>#return</#if> <#local sortedItems = items?sort_by(groupField)> <#local groupStart = 0> <#list sortedItems as item> <#if !item?is_first && item[groupField] != lastItem[groupField]> <#local groupEnd = item?index> <#nested lastItem[groupField], sortedItems[groupStart ..< groupEnd]> <#local groupStart = groupEnd> </#if> <#local lastItem = item> </#list> <#local groupEnd = sortedItems?size> <#nested lastItem[groupField], sortedItems[groupStart ..< groupEnd]> </#macro> <table style="width: 100%; margin-top: 10px"> <thead> <tr> <th style="padding: 10px 6px;">STYLE</th> <th colspan="3" style="padding: 10px 6px;">SIZE</th> <th colspan="12" style="padding: 10px 6px;">ITEM</th> <th align="center" colspan="3" style="padding: 10px 6px;">QUANTITY</th> <th align="right" colspan="4" style="padding: 10px 6px;">RATE</th> <th align="right" colspan="4" style="padding: 10px 6px;">AMOUNT</th> </tr> </thead> <@listGroups record.item "custcol_itemparent"; groupName, groupItems> <tr> <td rowspan="${groupItems?size+1}" style="padding: 10px 6px;">${groupName}</td> </tr> <#list groupItems as groupItem> <tr> <td align="center" colspan="3" style="padding: 10px 6px;">${groupItem.custcol_itemsizes}</td> <td colspan="12" style="padding: 6px 2px;"><span style="font-weight: bold; line-height: 150%; color: #333333;">${groupItem.item}</span><br />${groupItem.description}</td> <td align="center" colspan="3" line-height="150%">${groupItem.quantity}</td> <td align="right" colspan="4">${groupItem.rate}</td> <td align="right" colspan="4">${groupItem.amount}</td> </tr> </#list> </@listGroups> </table> <hr style="width: 100%; color: #D3D3D3; background-color: #D3D3D3; height: 1px;" /></#if> <table style="page-break-inside: avoid; width: 100%;"><tr> <td colspan="4">&nbsp;</td> <td align="right" style="font-weight: bold; color: #333333;">${record.subtotal@label}</td> <td align="right">${record.subtotal}</td> </tr> <tr> <td colspan="4">&nbsp;</td> <td align="right" style="font-weight: bold; color: #333333;">${record.taxtotal@label} (${record.taxrate}%)</td> <td align="right">${record.taxtotal}</td> </tr> <tr style="background-color: #E3E3E3; line-height: 200%;"> <td background-color="#FFFFFF" colspan="4">&nbsp;</td> <td align="right" style="font-weight: bold; color: #333333;">${record.total@label}</td> <td align="right">${record.total}</td> </tr></table> </body> </pdf>
@Beau
b
hmm not really sure, I tried looking for negative margins or anything that redflags me but I didn’t see anything on first glance.  no clue if it’s a styling issue or a freemarker/BFO rendering problem…. i do recommend that you refractor your code (move all inline styling to the top style tag), sometimes refractoring to separate style from function helps you zero-in on the problem