PD4ML v4 Forums PD4ML v3 Archived Forums (Read Only) PD4ML Tips & Tricks Conditionnal footer page number

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #26794

    Hello,

    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)

    Thanks

    #29156

    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.

Viewing 2 posts - 1 through 2 (of 2 total)

The forum ‘PD4ML Tips & Tricks’ is closed to new topics and replies.