Hi,

Check the FAQ for hints and caveats:
 http://xml.apache.org/fop/faq.html#faq-N10597

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()));

here i get a nullpointer, because first you must call driver.run.   

     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 thats not what i want.

I'm looking for an solution to calculate the number of pages without the
complete rendering process.

The FOP library provides a method to get the total page count after a FO
document has been rendered. You can implement your own wrapper to do a dummy
rendering, inquire the total page count and the perform the real rendering

an own wrapper? why doesnt exists a default-wrapper? How could i implemet
this?

thanks alex

-- 
+++ GMX - Mail, Messaging & more  http://www.gmx.net +++
NEU: Mit GMX ins Internet. Rund um die Uhr für 1 ct/ Min. surfen!


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to