Search code examples
javaapacheapache-fop

Apache FOP - how to find which data will be printed on which page


I am using Apache FOP to generate PDF from XSLT in my retail project and then print the PDF. A new requirement has come to print the running total in the footer of every page of receipt.

I am not sure how to achieve this because until unless we transform XSL to PDF, we don't know on which page it will be printed or is there anything I am not aware of?

Example:

PDF Page 1:

Item 1 10

Item 2 20

Total 30

Page 2:

Item 3 20

Item 4 10

Total 60

Any help is appreciated.


Solution

  • I did some google and finally found the solution that it can be done in XSLT itself.

    Refer http://www.java4less.com/apache/fop.php?info=xslfosubtotals

    Adding this answer just if someone else needs it.