- From: Marc.Sauber <marc.sauber@yellowtelecom.be>
- Date: Tue, 26 Oct 2004 13:17:19 +0200
- To: <www-xsl-fo@w3.org>
- Message-Id: <200410261111.i9QBBPR03421@guri.is.scarlet.be>
Hi, I would like to get and store the complete number of pages of my document. I created a library (jar file) with this (found on http://xml.apache.org/fop/) import org.apache.fop.apps.*; import org.xml.sax.*; import java.io.*; import javax.xml.transform.*; import javax.xml.transform.sax.*; import javax.xml.transform.stream.*; class rendtest { public static void main(String args[]) { try { Driver driver=new Driver(); driver.setOutputStream(new FileOutputStream(args[2])); driver.setRenderer(Driver.RENDER_PDF); Transformer transformer=TransformerFactory.newInstance() .newTransformer(new StreamSource(new File(args[1]))); transformer.setParameter("page-count","#"); transformer.transform(new StreamSource(new File(args[0])), new SAXResult(driver.getContentHandler())); String pageCount=Integer.toString(driver.getResults().getPageCount()); driver=new Driver(); driver.setOutputStream(new FileOutputStream(args[2])); driver.setRenderer(Driver.RENDER_PDF); transformer=TransformerFactory.newInstance() .newTransformer(new StreamSource(new File(args[1]))); transformer.setParameter("page-count",pageCount); transformer.transform(new StreamSource(new File(args[0])), new SAXResult(driver.getContentHandler())); } catch( Exception e) { e.printStackTrace(); } } } but I can't use it on my xsl file. How can I use page-count on my file ? Or Is there a better way to do ? Thank in advance. Marc marc.sauber@yellowtelecom.be
Attachments
- image/gif attachment: image001.gif
Received on Tuesday, 26 October 2004 11:12:46 UTC