PDF Generating Tool Support Forum

HOME   Login   Register    Search

  Subject: Conditionnal footer page number
   PostPosted: 14 Nov 2012, 13:21 

is it possible to add footer (with page number and total page number) only if document has more than 1 page ?

The setPagesToSkip(1) function isn't a good solution for me because it always hides page number on first page ; i need to display page number also on first page if document contains multiple pages.
The pd4ml.getLastRenderInfo(PD4Constants.PD4ML_TOTAL_PAGES) method might be the solution (in order to get document's total page number) but the renderer isn't initialised yet when defining footer. Is it possible to "prepare renderer" before generating PDF document ?

Note : I use the lastest PD4ML version (pd4ml.volume.380fx7)


  Subject: Re: Conditionnal footer page number
   PostPosted: 19 Nov 2012, 22:21 
Hmm... PD4ML cannot estimate a number of resulting PDF pages before a render() call.

I would recommend to run a first fake conversion procedure to an ignored ByteArrayOutputStream, just to let pd4ml.getLastRenderInfo() return a number of pages. After that you can make a decision either to specify a footer or not.

A feature you need requires a test conversion pass. It makes not much difference if you run it explicitly in your code, or we hide it somewhere in PD4ML logic.

[Reply]     [ 2 posts ] 

Copyright ©2004-10 zefer|org. All rights reserved. Bookmark and Share