I have an issue with the PO print, the PO lines ar...
# advancedpdf
n
I have an issue with the PO print, the PO lines are 10 all lines with long description the print is cutting off on the forth page and not all the lines show on the PDF hoe to fix this here is the code <?xml version="1.0"?> <!DOCTYPE pdf PUBLIC "-<//big.faceless.org//report>" "report-1.1.dtd"> <pdf> <head> <link name="verdana" type="font" subtype="opentype" src="${nsfont.verdana}" src-bold="${nsfont.verdana_bold}" bytes="2"></link> <macrolist> <macro id="nlheader"> <table class="header"> <tr> <td align="left"><#if companyInformation.logoUrl?length != 0><img height="45px" src="${companyInformation.logoUrl}" vertical-align="top" width="200px" /></#if></td> </tr> <tr height="8px"> <td align="left">&nbsp;</td> </tr> </table> </macro> <macro id="nlfooter"> <table align="right" border="0" class="footer"> <tr> <td><#if companyInformation.companyname?length != 0>${companyInformation.companyname}</#if></td> </tr> </table> </macro> </macrolist> <style type="text/css"> table { <#if .locale == "zh_CN"> font-family: stsong, sans-serif; <#elseif .locale == "zh_TW"> font-family: msung, sans-serif; <#elseif .locale == "ja_JP"> font-family: heiseimin, sans-serif; <#elseif .locale == "ko_KR"> font-family: hygothic, sans-serif; <#elseif .locale == "ru_RU"> font-family: verdana; #else font-family: sans-serif; </#if> font-size: 9pt; margin-top: 10px; table-layout: fixed; width: 100%; } th { font-weight: bold; font-size: 10pt; vertical-align: middle; padding-right: 8px; padding-left: 8px; padding-bottom: 3px; padding-top: 5px; background-color: #00467F; color: #FFFFFF; } td { padding-right: 6px; padding-left: 6px; padding-bottom: 4px; padding-top: 4px; } b { font-weight: bold; color: #333333; } body { <!--background-image: "https://system.na1.netsuite.com/core/media/media.nl?id=11246&amp;c=TSTDRV1124541&amp;h=76a16e376c879f645dbf";--> <!--background-image: ${record.custbody_fmt_pdf_background_img_url};--> background-color: #FFFFFF; } table.border_bottom tr{ border-bottom: 3px solid #black; } table.header{ <!--background-color: #EAEAEA;--> border-bottom: 4px solid #666666; } table.header td { padding: 0px; font-size: 10pt; } table.footer{ width: 92%; font-size: 5pt; color: #FFFFFF; } table.footer td { padding: 0px; font-size: 8pt; } table.itemtable th { padding-bottom: 5px; padding-top: 5px; } table.itemtable td { border: .5px solid #E0E0E0; } table.body td { padding-top: 2px; } table.total { page-break-inside: avoid; } table.total td{ color: #2B547E; } tr.totalrow { background-color: #FFFFFF; line-height: 200%; color: #2B547E; } td.addressheader { font-size: 8pt; padding-top: 8px; padding-bottom: 2px; text-transform: uppercase; } td.address { padding-top: 0px; } td.item { padding-top: 0px; border: 0px solid #FFFFFF; } span.title { font-size: 14pt; } span.number { font-size: 16pt; color:#00467f; } span.total { <!--color:#00467f;--> font-size: 10pt; } <style> table.itemtable tr { page-break-inside: avoid; } </style> hr { width: 100%; color: #D3D3D3; background-color: #D3D3D3; height: 1px; }</style></head> <body header="nlheader" header-height="8%" footer="nlfooter" footer-height="20pt"> <table align="left" border="0" width="100%"> <tr> <td class="addressheader" colspan="6"><b>${record.billaddress@label}</b></td> <td>&nbsp;</td> <td class="addressheader" colspan="6"><b>${record.shipaddress@label}</b></td> </tr> <tr> <td class="address" colspan="6"><span style="color:#666666;">${record.billaddress}</span></td> <td>&nbsp;</td> <td class="address" colspan="6"><span style="color:#666666;">${record.shipaddress}</span></td> </tr> </table> <table align="left" border="0" class="itemtable" width="100%"> <thead> <tr> <th colspan="8" style="align: left;">${record.tranid@label}</th> <th colspan="9" style="align: center;">${record.trandate@label}</th> <th colspan="7" style="align: center;">${record.total@label}</th> <td class="item" colspan="13">&nbsp;</td> </tr> </thead> <tr> <td colspan="8" style="align: left;"><span style="color:#666666;">${record.tranid}</span></td> <td colspan="9" style="align: center;"><span style="color:#666666;">${record.trandate}</span></td> <td colspan="7" style="align: center;"><span style="color:#666666;">${record.total}</span></td> <td class="item" colspan="13">&nbsp;</td> </tr> </table> <table align="left" border="0" class="itemtable" width="100%"> <thead> <tr> <th colspan="8" style="align: left;">${record.duedate@label}</th> <th colspan="9" style="align: left;">Purchase Contract</th> <th colspan="7" style="align: left;">Vendor Contact</th> <th colspan="6" style="align: left;">Phone</th> <th colspan="7" style="align: left;">Email</th> </tr> </thead> <tr> <td colspan="8"><span style="color:#666666;">${record.duedate}</span></td> <td colspan="9" style="align: left;"><span style="color:#666666;">${record.purchasecontract}</span></td> <td colspan="7"><span style="color:#666666;">${record.entity}</span></td> <td colspan="6"><span style="color:#666666;">${record.entity.phone}</span></td> <td colspan="7"><span style="color:#666666;">${record.entity.email}</span></td> </tr> </table> <#if record.item?has_content> <table align="left" class="itemtable" width="100%"><!-- start items --><#list record.item as item><#if item_index==0> <thead> <tr> <th colspan="8" style="align: left;">${item.item@label}</th> <th colspan="9">${item.description@label}</th> <th colspan="4" style="align: right;">${item.quantity@label}</th> <th colspan="3" style="align: left;">${item.units@label}</th> <th colspan="6" style="align: right;">${item.rate@label}</th> <th colspan="7" style="align: right;">${item.amount@label}</th> </tr> </thead> </#if> <tr style="background-color: ${((item_index % 2)==0)?string('#FFFFFF', '#F0F0F0')};"> <td colspan="8"><span style="color:#666666;">${item.item}</span></td> <td colspan="9"><span style="color:#666666;">${item.description}</span></td> <td colspan="4" style="align: right;"><span style="color:#666666;">${item.quantity}</span></td> <td colspan="3"><span style="color:#666666;">${item.units}</span></td> <td colspan="6" style="align: right;"><span style="color:#666666;">${item.rate}</span></td> <td colspan="7" style="align: right;"><span style="color:#666666;">${item.amount}</span></td> </tr> </#list><!-- end items --> </table> </#if> <hr /> <table align="left" border="0" width="100%"> <tr> <td colspan="24">&nbsp;</td> <td colspan="6" style="align: right;"><b><span class="total">${record.total@label}</span></b></td> <td align="right" colspan="7"><b><span class="total">${record.total}</span></b></td> </tr> </table> </body> </pdf>
a
I don't know the "right" way to do this but some people suggest checking the length of the content before you make the tr, and if it's too long, split the content into another line. Freemarker has some built-ins that can accomplish both the measuring of the content length (in number of characters) and also splitting it into a sequence/array. If you split the content into a sequence every x characters, then loop over that sequence, and render the first index of the sequence normally, then the additional rows can have td /td for all the other columns, and put the subsequent index of the split's contents in the td that was split on. This way, the content breaks to the next page, but only for that column. Here's how you get the long string to loop over segments of a given length: https://freemarker.apache.org/docs/ref_builtins_sequence.html#ref_builtin_chunk so if the item.description is the column that is pushing things off the page, do like this inside your #list item as item to make it break to a new table row every 2000 characters: #list item.description?matches('.{1,2000}', 's') as descriptionChunk #if chunk_index == 0 tr style="background-color: ${((item_index % 2)==0)?string('#FFFFFF', '#F0F0F0')};" td colspan="8"span style="color:#666666;"${item.item}/span/td td colspan="9"span style="color:#666666;"${descriptionChunk}/span/td td colspan="4" style="align: right;"span style="color:#666666;"${item.quantity}/span/td td colspan="3"span style="color:#666666;"${item.units}/span/td td colspan="6" style="align: right;"span style="color:#666666;"${item.rate}/span/td td colspan="7" style="align: right;"span style="color:#666666;"${item.amount}/span/td /tr #else tr style="background-color: ${((item_index % 2)==0)?string('#FFFFFF', '#F0F0F0')};" td colspan="8" /td td colspan="9"span style="color:#666666;"${descriptionChunk}/span/td td colspan="20" /td <!-- colspan condensed multiple td widths to one --> /tr /#if /#list
This code is untested, I literally just threw it onto the page as I thought it up, so think of it as pseudo code. You might want to split/regex-match on whitespace characters rather than in the middle of a word, though, so consider matching a regular expression that way instead.