Formatting page range references

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Formatting page range references

Mark Gibson
Hi,

I'm relatively new to XSL-FO and FOP.  I've got to the point where I need community advice.

We’re generating PDFs with dynamic content, including a known section across one or more pages towards the end of the document.  We're also generating text on the first page that references the page numbers of said section.  The difficulty comes due to a formatting requirement ... when we're referencing a single page, the format MUST be a single number, whilst when referencing multiple pages it should be of the form ${first page} - ${last page}.

We tried the case where we had the referenced content in one block with id=A, and a second empty block following with id=B.  When using <fo:page-number-citation> for both blocks, there's no option to change format based on number of pages ...

            <fo:block>
                Pages  <fo:page-number-citation ref-id="A"/> -  <fo:page-number-citation ref-id="B"/>
            </fo:block>

So, where the section is on a single page, our reference becomes "9 - 9".  And strict formatting requirements mean we are not allowed to generate this format in this case.

I got excited when I saw some of the Index related FO objects in the XSL-FO spec, but then discovered that FOP currently does not support any of the index features.  Is this true?

I then found support listed for <fo:multi-switch> on the FOP compliance web page, but it seems to imply that this is only implemented for the extension property "fox:auto-toggle".  So I'm guessing this won't support our requirements either.  Is this true?

Exhausting my exceedingly limited xsl-fo knowledge, and if you can confirm there's no xsl-fo solution to this, I'm left assuming I have possibly two options (listed in the order of preference):

1. Generate the intermediate format / area tree format, edit, then render from that format.  (is this possible? If so, should one use the IF or the AT format?)
2. Post process the rendered PDF (using PDFBox, iText, or something similar).

I'm hoping someone more experienced than me can comment on relevant XSL-FO capabilities within FOP, and if necessary, the IF/AT question/approach.

Many thanks
Mark


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]
Reply | Threaded
Open this post in threaded view
|

RE: Formatting page range references

Furst,Thomas
Hello,

I do not believe this is possible with FOP in a single pass processing. Have you looked at using the intermediate format (https://xmlgraphics.apache.org/fop/2.3/intermediate.html) as a possible way to process this?

Tom Furst

-----Original Message-----
From: Mark Gibson <[hidden email]>
Sent: Monday, September 2, 2019 5:32 PM
To: [hidden email]
Subject: Formatting page range references

Hi,

I'm relatively new to XSL-FO and FOP.  I've got to the point where I need community advice.

We’re generating PDFs with dynamic content, including a known section across one or more pages towards the end of the document.  We're also generating text on the first page that references the page numbers of said section.  The difficulty comes due to a formatting requirement ... when we're referencing a single page, the format MUST be a single number, whilst when referencing multiple pages it should be of the form ${first page} - ${last page}.

We tried the case where we had the referenced content in one block with id=A, and a second empty block following with id=B.  When using <fo:page-number-citation> for both blocks, there's no option to change format based on number of pages ...

            <fo:block>
                Pages  <fo:page-number-citation ref-id="A"/> -  <fo:page-number-citation ref-id="B"/>
            </fo:block>

So, where the section is on a single page, our reference becomes "9 - 9".  And strict formatting requirements mean we are not allowed to generate this format in this case.

I got excited when I saw some of the Index related FO objects in the XSL-FO spec, but then discovered that FOP currently does not support any of the index features.  Is this true?

I then found support listed for <fo:multi-switch> on the FOP compliance web page, but it seems to imply that this is only implemented for the extension property "fox:auto-toggle".  So I'm guessing this won't support our requirements either.  Is this true?

Exhausting my exceedingly limited xsl-fo knowledge, and if you can confirm there's no xsl-fo solution to this, I'm left assuming I have possibly two options (listed in the order of preference):

1. Generate the intermediate format / area tree format, edit, then render from that format.  (is this possible? If so, should one use the IF or the AT format?) 2. Post process the rendered PDF (using PDFBox, iText, or something similar).

I'm hoping someone more experienced than me can comment on relevant XSL-FO capabilities within FOP, and if necessary, the IF/AT question/approach.

Many thanks
Mark

NOTE: This email message and any attachments are for the sole use of the intended recipient(s) and may contain confidential and/or privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by replying to this email, and destroy all copies of the original message. Thank you, RCM Technologies.<https://www.rcmt.com>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]