This topic contains 8 replies, has 0 voices, and was last updated by EnablingSolutions 8 years, 7 months ago.
-
AuthorPosts
-
February 17, 2015 at 8:26 am #2207
jwenzerI am trying to wrap my head around what I thought would be a simple task. We are moving to using the Advanced PDF Template for our invoices, and I want to print the page number, but only if there are more than 1 pages. This seems to be not easy to do, because it is a mix of both Freemarker and BFO. BFO has the pagenumber and totalpages variables, but can those be accessed using Freemarker if statement?
This is what I am trying:
Code:
1)>Pageof #if>
It is giving me a Expression totalpages is undefined error when trying to save the template.
This is a cached copy. Click here to see the original post. -
February 17, 2015 at 8:46 am #2208
coreyHow about if you just check if pagenumber is not 1.
jwenzer replied on 02/17/2015, 09:25 AM: I get the same basic error, that pagenumber is undefined.
-
February 17, 2015 at 8:52 am #2209
wwintersHmmm..
I wonder if something like this might work:
<#assign totalpages="”>
1)>Page of
Let me know if that works.
Best,
Wes
jwenzer replied on 02/17/2015, 09:26 AM: The editor keeps changing your first line of code into HTML (I can’t get it to save in this editor!):
-
February 17, 2015 at 9:42 am #2210
wwintersDrat! Sounds like it might be a defect in the XML parser.
-
March 17, 2015 at 7:01 pm #2211
rgonzalestry using
-
March 27, 2015 at 9:55 am #2212
charoldsonAssigning the variable works fine, but the problem is in the comparison. NetSuite will not allow us to Save the template with the #if statement in it. When saving, it appears the HTML editor is validating the HTML. It sees the totalPages variable as a FreeMarker SimpleScalar type (since has not been evaluated yet) and trying to compare it to the number 1, which is a Number type.
I haven’t found a way around it yet.
-
April 1, 2015 at 6:37 am #2213
dmatyasHi,
this cannot work from the nature of used technologies.
Here is what is happening during PDF generation:
1. Template gets merged with datasource using Freemarker – all Freemarker constructs gets evaluated in this step as well – as a result we get “processed template” which is now fully qualified XHTML (with BFO tags in it, but without any FreeMarker). At this point it is unknown how many pages will be in resulting PDF.
2. “Processed Template” goes to XML to PDF function, where BFO engine simply translates XHTML into PDF. No scripting is available during this phase therefore there cannot be any conditional changes to what will be in resulting PDF.
I hope my explanation is understandable.
Thanks,
Daniel
-
September 4, 2015 at 3:58 pm #2214
jakubwagnerThere is also one commonly hit limitation of BFO also mentioned in their FAQ (http://bfo.com/faq.jsp) :
How do I set headers and footers for specific pages ?
The Report Generator userguide has a section devoted to headers and footers. In version 1.1.x of the Report Generator the options for setting headers are:
Setting them for specific pages using the page selector in the style sheet.
Setting them in the tag and tags, in which case the header and footer will be changed from that point forward.
Setting them for odd and even pages using the CSS2 right and left selectors for the body tag in the style sheet (see the “examples/dynamic/bigtable.jsp” example in the download package).
At the moment we do not have a facility for explicitly assigning a footer or header to the last page in a document when the number of pages is unknown.
Regarding to the page problem, there might be one possibility, however I have not tested it:
In the BFO user guide(http://bfo.com/products/report/docs/userguide.pdf) there is mentioned:
Each page in the document is given a unique ID equal to โpageโ followed by the current pagenumber.
For example, hereโs how to set the size and background color of the first page.
Code:
#page1 { size:A4-landscape; background-color:yellow; }
So there may be some opportunity to magic as the BFO do support CSS2 (http://bfo.com/products/report/docs/tags/) and if its really true that there are reserved values like #page1 – #pageXYZ -
April 12, 2016 at 5:13 am #2215
EnablingSolutionsHi all
Is there any movement on this? Has anyone been able to achieve it?
Thanks
Pete.
-
AuthorPosts
You must be logged in to reply to this topic.