Radicore Forum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » RADICORE » How To » PDF Footer
PDF Footer [message #2409] Wed, 20 January 2010 13:20 Go to next message
gpatti is currently offline  gpatti
Messages: 283
Registered: August 2008
Senior Member
I've been successfully using a footer in PDF output that contains a substitution element (%%footer_details).

I've now changed my code to add subtotals to entities (so effectively the last item on each page unless an entity runs over more than one page) and have noticed that the footer is not appearing correctly. Using the debugger I can see and understand why this is happening: it's simply because when I print my subtotals using the _cm_listView_print_after() method that is usually the last data printed on the page, but this does not contain the footer data unless I specifically put it back in again at this point. (My assumption here is that the footer data is just taken from the last available row of data printed).

With this knowledge I can recode to fix my reports. However, I thought it might be appropriate to have an equivalent to the _cm_listView_header() method for footers. This would make it easier to ensure the footer was correct, regardless of which method creates the last line on a page.

Your thoughts?
Re: PDF Footer [message #2410 is a reply to message #2409] Wed, 20 January 2010 13:52 Go to previous messageGo to next message
gpatti is currently offline  gpatti
Messages: 283
Registered: August 2008
Senior Member
I've been taking a closer look with the debugger and now I'm not sure that my previous assumption was correct about how the footer prints its data. I'm thinking that with the recent changes it may not be getting processed at all as I can only get the token name to appear on the report.

Can you confirm when and how the footer is printed?

Thanks,

Graham
Re: PDF Footer [message #2411 is a reply to message #2410] Wed, 20 January 2010 15:50 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2368
Registered: April 2006
Location: Surrey, UK
Senior Member
The footer is printed as follows:

Whenever the AddPage() function is called it does the following:
- call endPage() to end the current page (if there is one).
- call startPage() to start a new page.

The endPage() function calls setFooter() which calls Footer() which calls printFooter() for each of the two possible footer lines as defined in the report structure file.

The printFooter() function uses the last record read for any %%field substitutions, which after my last change is now the 'next' record (as used in the updated _cm_ListView_print_after() function) instead of the 'current' record.

The printFooter() function does NOT use any of the extra rows created by the _cm_ListView_print_before() or _cm_ListView_print_after() functions.

Attached is an updated version of std.pdf.class.inc which now uses the 'previous' record instead of the 'last' record. Try it out to see if it fixes your problem.


Re: PDF Footer [message #2412 is a reply to message #2409] Wed, 20 January 2010 17:31 Go to previous messageGo to next message
gpatti is currently offline  gpatti
Messages: 283
Registered: August 2008
Senior Member
That change hasn't solved the problem.

I am actually creating the substitution token in _cm_formatData() by inserting it directly into $rowdata that is being returned. There is no field specification for the item. Is it possible it is getting filtered out somewhere? It was working OK until the additional call to formatData to solve the problem of formatting in ...print_before() and ...print_after().
Re: PDF Footer [message #2413 is a reply to message #2412] Wed, 20 January 2010 17:52 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2368
Registered: April 2006
Location: Surrey, UK
Senior Member
The _cm_formatData() method is now not called until just before the row is actually printed. You should move your code which inserts new data to the _cm_post_fetchRow() method.

Re: PDF Footer [message #2414 is a reply to message #2409] Wed, 20 January 2010 18:05 Go to previous message
gpatti is currently offline  gpatti
Messages: 283
Registered: August 2008
Senior Member
Yep - that's fixed it!

Thanks for the pointer.
Previous Topic: Sub totals and Page Breaks
Next Topic: Formatting in _cm_listView_header() method
Goto Forum:
  


Current Time: Sun Nov 24 22:09:31 EST 2024

Total time taken to generate the page: 0.03270 seconds