views:

76

answers:

1
+1  Q: 

Pagination problem

Currently I have some xml documents which are converted via xsl into html. The html is converted via abcpdf into a pdf document. The content of the pages is dynamic. A page is represented by a div tag, however the amount of content going in could in fact be 3 pages long & I need some pages to have a header and a footer inserted and some not, so if a div tag has 3 pages worth of content, that means 3 headers and 3 footers inserting.

Also as the content is dynamic,page 10 may have no footer or header, however once the logic of the application has ran through a 2nd time page 10 could in fact be page 20.

I am looking for a solution which uses css to add the headers and footers conditionally. Its easy to use XSL to add them but as a div can contain up to 3 pages worth of content I need a way of adding the headers and footers (or possibly not) in all 3 pages contained within a div.

I have looked at css pagination, but not sure if this is the right solution.

Any ideas would be greatfully received

+1  A: 

Have you considered using XSL-FO (www.w3schools.com/xslfo/xslfo_intro.asp) with Apache FOP (xmlgraphics.apache.org/fop) to transform your XML content directly into a PDF? Unlike CSS XSL-FO is designed for print and as such pagination is part of the language. It is also quite easy to pick up if you already know XSLT & CSS, in fact the formatting syntax is taken from CSS 2. You could even use it on the HTML if it is valid XHTML, and there are tools such as CSSToXSLFO (www.re.be/css2xslfo/index.xhtml) that can help.

Mike
Thats been really helpful, I did take a quick look at it, but as visual studio doesn't come with an xsl:fo processor, I left it at that, from looking at the links you gave, xsl:fo does a lot more than I first realised. It's a bit late unfortunately to look at it for my current project, but, certainly I will be having a look at it in future projects because of the flexibility it brings and the fact I can directly go from xml to pdf.Thanks
Miker169