You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Roberto Nunnari <ro...@nunnari.net> on 2015/03/22 17:30:38 UTC

page number, but only if more than one page exists

Hi.

I need to change a servlet that generates a FO document and then 
transforms it into a pdf document. Unfortunately I know almost nothing 
about Formatting Objects. :-(

At present the FO adds the page number on every page.

I need to change it so that it adds the page number, but only if there 
are more than one page.

fop version in use is very old.. 0.91beta and build-Id is from 20051223

Any help very appreciated.

Thank you and best regards.
Robi

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: page number, but only if more than one page exists

Posted by Roberto Nunnari <ro...@nunnari.net>.
On 22. 03. 15 22:41, Rob Sargent wrote:
> if you're using xsl transformation... have you tried
>
> <xsl:if test="fo:page-number != 0">
>      <your current page numbering here
> </xsl:if>

Thank you Rob, but it's not using xsl transformation..
Robi


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: page number, but only if more than one page exists

Posted by Rob Sargent <rs...@xmission.com>.
if you're using xsl transformation... have you tried

<xsl:if test="fo:page-number != 0">
     <your current page numbering here
</xsl:if>



On 03/22/2015 10:30 AM, Roberto Nunnari wrote:
> Hi.
>
> I need to change a servlet that generates a FO document and then 
> transforms it into a pdf document. Unfortunately I know almost nothing 
> about Formatting Objects. :-(
>
> At present the FO adds the page number on every page.
>
> I need to change it so that it adds the page number, but only if there 
> are more than one page.
>
> fop version in use is very old.. 0.91beta and build-Id is from 20051223
>
> Any help very appreciated.
>
> Thank you and best regards.
> Robi
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: page number, but only if more than one page exists

Posted by "Terence M. Bandoian" <te...@tmbsw.com>.
Good idea.  Another option would be to never show the page number on the 
first page.

-Terence Bandoian


On 3/22/2015 5:21 PM, Luis Bernardo wrote:
>
> Try using a mix of page masters with different page positions (see 
> http://www.w3.org/TR/xsl/#page-position).
>
> You will need a page master with page-position="only" without the page 
> number, and a page master with page numbers when there is more than 
> one page (i.e. when page-position="only" does not apply).
>
> On 3/22/15 10:43 PM, Roberto Nunnari wrote:
>> On 22. 03. 15 17:30, Roberto Nunnari wrote:
>>> Hi.
>>>
>>> I need to change a servlet that generates a FO document and then
>>> transforms it into a pdf document. Unfortunately I know almost nothing
>>> about Formatting Objects. :-(
>>>
>>> At present the FO adds the page number on every page.
>>>
>>> I need to change it so that it adds the page number, but only if there
>>> are more than one page.
>>>
>>> fop version in use is very old.. 0.91beta and build-Id is from 20051223
>>>
>>> Any help very appreciated.
>>>
>>> Thank you and best regards.
>>> Robi
>>
>> Hi.
>>
>> I got a slightly better result than having only the number using
>> <page-number /> / <page-number-citation ref-id="last-page"/>
>>
>> and adding an empty block at the end of the flow..
>> <block id="last-page"/>
>>
>> It works.. and it's already better than having just the page number 
>> because seeing also the total number of pages lets you know if you 
>> have in your hands the whole document or not.. but it's not exactly 
>> what I was asked to do..
>>
>> Any hints on how to accomplish the original goal?
>> Thank you and best regards.
>> Robi
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
>> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: page number, but only if more than one page exists

Posted by Pascal Sancho <ps...@gmail.com>.
Hi,

IIRC, there were a lot of bugfixes and additions in page-master
management since FOP v0.91.

To play with Luis' idea, you have 1st to upgrade FOP

2015-03-23 9:45 GMT+01:00 Szeak (Register Man) <sz...@gmail.com>:
> Hi,
> I think, Barnardo's idea is the best for you.
>
> bye
>
> 2015-03-22 23:21 keltezéssel, Luis Bernardo írta:
>
>>
>> Try using a mix of page masters with different page positions (see
>> http://www.w3.org/TR/xsl/#page-position).
>>
>> You will need a page master with page-position="only" without the page
>> number, and a page master with page numbers when there is more than one page
>> (i.e. when page-position="only" does not apply).
>>
>> On 3/22/15 10:43 PM, Roberto Nunnari wrote:
>>>
>>> On 22. 03. 15 17:30, Roberto Nunnari wrote:
>>>>
>>>> Hi.
>>>>
>>>> I need to change a servlet that generates a FO document and then
>>>> transforms it into a pdf document. Unfortunately I know almost nothing
>>>> about Formatting Objects. :-(
>>>>
>>>> At present the FO adds the page number on every page.
>>>>
>>>> I need to change it so that it adds the page number, but only if there
>>>> are more than one page.
>>>>
>>>> fop version in use is very old.. 0.91beta and build-Id is from 20051223
>>>>
>>>> Any help very appreciated.
>>>>
>>>> Thank you and best regards.
>>>> Robi
>>>
>>>
>>> Hi.
>>>
>>> I got a slightly better result than having only the number using
>>> <page-number /> / <page-number-citation ref-id="last-page"/>
>>>
>>> and adding an empty block at the end of the flow..
>>> <block id="last-page"/>
>>>
>>> It works.. and it's already better than having just the page number
>>> because seeing also the total number of pages lets you know if you have in
>>> your hands the whole document or not.. but it's not exactly what I was asked
>>> to do..
>>>
>>> Any hints on how to accomplish the original goal?
>>> Thank you and best regards.
>>> Robi
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
>>> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
>> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>



-- 
pascal

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: page number, but only if more than one page exists

Posted by "Szeak (Register Man)" <sz...@gmail.com>.
Hi,
I think, Barnardo's idea is the best for you.

bye

2015-03-22 23:21 keltezéssel, Luis Bernardo írta:
>
> Try using a mix of page masters with different page positions (see 
> http://www.w3.org/TR/xsl/#page-position).
>
> You will need a page master with page-position="only" without the page 
> number, and a page master with page numbers when there is more than 
> one page (i.e. when page-position="only" does not apply).
>
> On 3/22/15 10:43 PM, Roberto Nunnari wrote:
>> On 22. 03. 15 17:30, Roberto Nunnari wrote:
>>> Hi.
>>>
>>> I need to change a servlet that generates a FO document and then
>>> transforms it into a pdf document. Unfortunately I know almost nothing
>>> about Formatting Objects. :-(
>>>
>>> At present the FO adds the page number on every page.
>>>
>>> I need to change it so that it adds the page number, but only if there
>>> are more than one page.
>>>
>>> fop version in use is very old.. 0.91beta and build-Id is from 20051223
>>>
>>> Any help very appreciated.
>>>
>>> Thank you and best regards.
>>> Robi
>>
>> Hi.
>>
>> I got a slightly better result than having only the number using
>> <page-number /> / <page-number-citation ref-id="last-page"/>
>>
>> and adding an empty block at the end of the flow..
>> <block id="last-page"/>
>>
>> It works.. and it's already better than having just the page number 
>> because seeing also the total number of pages lets you know if you 
>> have in your hands the whole document or not.. but it's not exactly 
>> what I was asked to do..
>>
>> Any hints on how to accomplish the original goal?
>> Thank you and best regards.
>> Robi
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
>> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: page number, but only if more than one page exists

Posted by Roberto Nunnari <ro...@nunnari.net>.
Thank you all! :-)

Now I have a couple of alternatives to work on.

Best regards.
Robi


Il 22.03.2015 23:21, Luis Bernardo ha scritto:
> 
> Try using a mix of page masters with different page positions (see 
> http://www.w3.org/TR/xsl/#page-position).
> 
> You will need a page master with page-position="only" without the
> page number, and a page master with page numbers when there is more
> than one page (i.e. when page-position="only" does not apply).
> 
> On 3/22/15 10:43 PM, Roberto Nunnari wrote:
>> On 22. 03. 15 17:30, Roberto Nunnari wrote:
>>> Hi.
>>> 
>>> I need to change a servlet that generates a FO document and
>>> then transforms it into a pdf document. Unfortunately I know
>>> almost nothing about Formatting Objects. :-(
>>> 
>>> At present the FO adds the page number on every page.
>>> 
>>> I need to change it so that it adds the page number, but only
>>> if there are more than one page.
>>> 
>>> fop version in use is very old.. 0.91beta and build-Id is from
>>> 20051223
>>> 
>>> Any help very appreciated.
>>> 
>>> Thank you and best regards. Robi
>> 
>> Hi.
>> 
>> I got a slightly better result than having only the number using 
>> <page-number /> / <page-number-citation ref-id="last-page"/>
>> 
>> and adding an empty block at the end of the flow.. <block
>> id="last-page"/>
>> 
>> It works.. and it's already better than having just the page
>> number because seeing also the total number of pages lets you
>> know if you have in your hands the whole document or not.. but
>> it's not exactly what I was asked to do..
>> 
>> Any hints on how to accomplish the original goal? Thank you and
>> best regards. Robi


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: page number, but only if more than one page exists

Posted by Luis Bernardo <lm...@gmail.com>.
Try using a mix of page masters with different page positions (see 
http://www.w3.org/TR/xsl/#page-position).

You will need a page master with page-position="only" without the page 
number, and a page master with page numbers when there is more than one 
page (i.e. when page-position="only" does not apply).

On 3/22/15 10:43 PM, Roberto Nunnari wrote:
> On 22. 03. 15 17:30, Roberto Nunnari wrote:
>> Hi.
>>
>> I need to change a servlet that generates a FO document and then
>> transforms it into a pdf document. Unfortunately I know almost nothing
>> about Formatting Objects. :-(
>>
>> At present the FO adds the page number on every page.
>>
>> I need to change it so that it adds the page number, but only if there
>> are more than one page.
>>
>> fop version in use is very old.. 0.91beta and build-Id is from 20051223
>>
>> Any help very appreciated.
>>
>> Thank you and best regards.
>> Robi
>
> Hi.
>
> I got a slightly better result than having only the number using
> <page-number /> / <page-number-citation ref-id="last-page"/>
>
> and adding an empty block at the end of the flow..
> <block id="last-page"/>
>
> It works.. and it's already better than having just the page number 
> because seeing also the total number of pages lets you know if you 
> have in your hands the whole document or not.. but it's not exactly 
> what I was asked to do..
>
> Any hints on how to accomplish the original goal?
> Thank you and best regards.
> Robi
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: page number, but only if more than one page exists

Posted by Roberto Nunnari <ro...@nunnari.net>.
On 22. 03. 15 17:30, Roberto Nunnari wrote:
> Hi.
>
> I need to change a servlet that generates a FO document and then
> transforms it into a pdf document. Unfortunately I know almost nothing
> about Formatting Objects. :-(
>
> At present the FO adds the page number on every page.
>
> I need to change it so that it adds the page number, but only if there
> are more than one page.
>
> fop version in use is very old.. 0.91beta and build-Id is from 20051223
>
> Any help very appreciated.
>
> Thank you and best regards.
> Robi

Hi.

I got a slightly better result than having only the number using
<page-number /> / <page-number-citation ref-id="last-page"/>

and adding an empty block at the end of the flow..
<block id="last-page"/>

It works.. and it's already better than having just the page number 
because seeing also the total number of pages lets you know if you have 
in your hands the whole document or not.. but it's not exactly what I 
was asked to do..

Any hints on how to accomplish the original goal?
Thank you and best regards.
Robi


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: page number, but only if more than one page exists

Posted by "Szeak (Register Man)" <sz...@gmail.com>.
Hi again,

If you want to add page number also for the first page, when the 
document have more than one pages, you'll need 2 times rendering.
After first you can check the number of pages, than when you know it, 
you can format your document with the needed page numbering option.
FOP can produce page numbers after rendering. ie.: You can render first 
into an Intermediate Format, second to PDF. But you can choose another 
way also ...

Bye.

2015-03-22 17:30 keltezéssel, Roberto Nunnari írta:
> Hi.
>
> I need to change a servlet that generates a FO document and then 
> transforms it into a pdf document. Unfortunately I know almost nothing 
> about Formatting Objects. :-(
>
> At present the FO adds the page number on every page.
>
> I need to change it so that it adds the page number, but only if there 
> are more than one page.
>
> fop version in use is very old.. 0.91beta and build-Id is from 20051223
>
> Any help very appreciated.
>
> Thank you and best regards.
> Robi
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: page number, but only if more than one page exists

Posted by "Szeak (Register Man)" <sz...@gmail.com>.
Hi,

Another option to define 2 different page-master, one for the first 
page, and one for rest of pages.
Then define a page-sequence-master for a complex set of pages.

Example:

<fo:root>
	<fo:layout-master-set>
		<fo:simple-page-master master-name="a4" page-width="21cm" page-height="297mm" margin-top="1cm" margin-left="1cm" margin-right="1cm" margin-bottom="1cm">
			<fo:region-body/>
		</fo:simple-page-master>
		<fo:simple-page-master master-name="a4_rest_footer" page-width="21cm" page-height="297mm" margin-top="1cm" margin-left="1cm" margin-right="1cm" margin-bottom="0.5cm">
			<fo:region-body margin-bottom="1cm"/>
			<fo:region-after extent="1cm"/>
		</fo:simple-page-master>

		<fo:page-sequence-master master-name="complex">
			<fo:repeatable-page-master-alternatives>
				<fo:conditional-page-master-reference page-position="first" master-reference="a4"/>
				<fo:conditional-page-master-reference page-position="any" master-reference="a4_rest_footer"/>
			</fo:repeatable-page-master-alternatives>
		</fo:page-sequence-master>
	</fo:layout-master-set>
	
	<fo:page-sequence initial-page-number="1" master-reference="complex" force-page-count="no-force">
		<fo:static-content flow-name="xsl-region-after">
			<fo:block><fo:page-number/></fo:block>
		</fo:static-content>
		<fo:flow flow-name="xsl-region-body">
			<!-- Here comes the document body -->
		</fo:flow>
	</fo:page-sequence>
</fo:root>


Bye, Szeak

2015-03-22 17:30 keltezéssel, Roberto Nunnari írta:
> Hi.
>
> I need to change a servlet that generates a FO document and then 
> transforms it into a pdf document. Unfortunately I know almost nothing 
> about Formatting Objects. :-(
>
> At present the FO adds the page number on every page.
>
> I need to change it so that it adds the page number, but only if there 
> are more than one page.
>
> fop version in use is very old.. 0.91beta and build-Id is from 20051223
>
> Any help very appreciated.
>
> Thank you and best regards.
> Robi
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org