Done. Thanks for the hint.

Jeremias Maerki



On 14.11.2007 11:07:57 Gregan, Miroslav wrote:
> 
> Hi,
> 
> I found a document that is not up to date:
> 
> http://xmlgraphics.apache.org/fop/fo.html#fo-total-pages
> 
> A new example like the following should be added for FOP 0.94 (or
> replace the current FOP 0.20.5)
> 
> class rendtest {
> 
>   public static void main(File fo, File pdf) {
>     OutputStream out = null;
>     try {
>       FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
>       out = new FileOutputStream(pdf);
>       out = new BufferedOutputStream(out);
>       Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent,
> out);
>       TransformerFactory factory = TransformerFactory.newInstance();
>       Transformer transformer = factory.newTransformer();
>       Source src = new StreamSource(fo);
>       Result res = new SAXResult(fop.getDefaultHandler());
>       transformer.transform(src, res);
> 
>       // Read total page number and set the FO's page-count parameter
>       transformer.setParameter("page-count",
> Integer.toString(fop.getResults().getPageCount()));
> 
>       transformer.transform(src, res);
>     }
>     catch( Exception e) {
>       e.printStackTrace();
>     }
>     finally {
>       if (out != null) {
>         out.close();
>       }
>     }
>   }
> }
> 
> Cheers,
> 
> Miro


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

Reply via email to