Hello again. Just wanted to see if anyone has an i...
# advancedpdf
a
Hello again. Just wanted to see if anyone has an idea or if I should go to NetSuite Support (would really like to avoid NSS) "I have a Long Text field that prints on our forms. Due to the number of characters this field can hold, not everything prints. Instead of it spilling onto the next page, it cuts-off at the end of the first page. Is there a way to fix this?"
a
The behavior is usually caused by the text container element. Have you used the page-break style ?
a
I have not. You think style="page-break-before: always" would work?
That did not work
a
page-break-inside:avoid; <p style="page-break-after: always;">&nbsp;</p>
I think this is not the official freemarker solution. looking for it
a
Okay, let me give that a try. Thank you.
That is not working either.
a
As in HTML pages the layout is decided from the container, most of the times. What is the container element for your text? If it's a table it's really difficult that you will get it managed. Use a "div" or "p" instead. If you are in a table context than you can't get what you want (almost sure) and you should add the EACH condition outside the table (create a table with a single line for each row instead of a single table with a lot of rows) and this will perform the trick (if you insert the page break instruction). Of course, since you are using more tables than you will experience another bad behavior. So you won't have "aligned" columns by default. But you can get this setting stiles for TD and TR
a
It is a stand alone field. I was using span but have also tried just <td> and <p>
It is not a table
a
So you have a PDF with a single DIV in the body containing the text?
a
I said that incorrectly. Here is the code. It is quotetext2 that is the problem.
Copy code
<table style="font-size:10px" >
    <#if record.custbody_quotetext1?has_content>
      <tr>
        <td style="font-size:12px"><b>${record.custbody_quotetext1@label}</b></td></tr>
<tr>
    <td style="page-break-inside:always;">${record.custbody_quotetext1}</td>
	</tr></#if>
  <#if record.custbody_quotetext2?has_content>
  <tr>
    <td style="font-size:12px"><b>${record.custbody_quotetext2@label}</b></td></tr>
    <tr>
    <td style="page-break-inside:always;">${record.custbody_quotetext2}</td>
	</tr></#if></table>
a
<pdf> <body> <div>{$longText}</div> </body> </pdf>
a
So avoid the table altogether?
👍 1
a
Ok, so it corresponds to the description in my message. You are into a table context..
a
Yes.
Okay. I will take it out of table and see what happens
Thank you
I was confusing table and list
a
Not sure it will work but I'm almost sure.... Lot of time I confuse CSS behaviors in BFO and regular browsers 🙂
a
Thanks
I got it to work with the following: <!-- start of item table in transaction --> <#list record.item as item> <#if item_index==0> <!-- Header Definition --> <tr> <th>${item.field1@label}</th> <th>${item.long_text_field@label}</th> <th>${item.field2@label}</th> <!-- ... --> </tr> </#if> <#list item.long_text_field?split("<br />") as paragraph> <#if desc_index==0> <tr> <td>${item.field1}</td> <td>${paragraph}</td> <td>${item.field2}</td> <!-- ... --> </tr> #else <tr> <td></td> <td>${paragraph}</td> <td></td> <!-- ... --> </tr> </#if> </#list> </#list>
So <#list item.long_text_field?split("<br />") as paragraph> then use <td>${paragraph}</td> instead of the field name iteself.
a
Is not really elegant convert a text to a table row but if it works it works 🙂
Just consider that if you have a long text in the last page row without a BR the solution will not work... and you will have the last row text "cutted"
I would suggest to simulate the case and to try to manage the page break for the TR tag for avoid the cell showing only partial text
a
Thank you for the suggestion. I will definitely give it a try.
Thank you for all your help.
a
You are more than welcome 🙂