W3C home > Mailing lists > Public > www-xsl-fo@w3.org > September 2015

Re: Different formatting of a block, depending on its page position in PDF

From: G. Ken Holman <gkholman@CraneSoftwrights.com>
Date: Sat, 26 Sep 2015 11:00:50 -0400
Message-Id: <7.0.1.0.2.20150926090434.022de648@wheresmymailserver.com>
To: doku@grubitz.de,www-xsl-fo@w3.org
At 2015-09-25 16:57 +0200, Pia Grubitz (Grubitz Dokumenten-Management) wrote:
>Hi all,
>I'm new in this mailing list, so please apologize any of my wrongdoings.
>
>FOP 1.1
>Question: Is there any condition to find the position of a 
>text-block in the PDF-file.
>
>This is the problem:
>I need to change the formatting of a title-block depending on its 
>position on the page.
>- If the title-block appears somewhere in the (vertical) middle of 
>the page, I want to add a line on top of it.
>- If the title-block appears at the beginning/top of a page the line 
>must not appear.

In the XSL-FO 1.1 data-flow design there is no feedback loop back to 
the XSLT for such conditional processing.  You cannot in the XSLT 
change what appears and what does not appear based on the end result 
location on the page of a construct.  You must express everything you 
need in the XSL-FO 1.1 semantics and leave it to the formatter to format.

In the XSL-FO 1.1 specification there is also no conditional that 
would make a given construct invisible.  You can arbitrarily make a 
construct invisible, but not conditionally make it invisible.

Going outside of the specification you can work with the intermediate 
area tree that some vendors will create from interpreting your 
XSL-FO.  You would inspect the area tree, see the undesired line at 
the top of the page and simply remove it.  But that would then, 
probably, shift your text up from the bottom of the page, which you 
may not want to have happen.

I have just tried numerous contortions with table headers and markers 
to try and trick the processor into omitting the conditional line by 
retrieving a blank marker in place of a marker with the conditional 
line, but I cannot find a way to do so (but I got real close).  I'm 
confident that the XSL-FO specification will prevent you from doing 
what you want and that you'll have to resort to massaging the 
information outside of the XSL-FO specification methods.

I've attached the results of my tests, both the PDF generated by 
Antenna House and the XSL-FO.  Tests A and B work, where the title is 
in the middle of the page in test A (the hidden line is shown) and at 
the top of the page in test B (the hidden line is hidden).  But my 
scheme does not work when the title is at the bottom of the page in 
test C (the hidden line is hidden when it isn't supposed to be), so 
it isn't complete, and I see no way of making it complete.

Whether or not what I have can be replicated in FOP, I don't 
know.  Perhaps FOP has an extension someone knows about that will help you.

I hope this is helpful, even if to tell you what you need is probably 
not available.

. . . . . . . . Ken 

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus


--
Check our site for free XML, XSLT, XSL-FO and UBL developer resources |
Free 5-hour lecture:  http://www.CraneSoftwrights.com/links/video.htm |
Crane Softwrights Ltd.             http://www.CraneSoftwrights.com/f/ |
G. Ken Holman                    mailto:gkholman@CraneSoftwrights.com |
Google+ profile:       http://plus.google.com/+GKenHolman-Crane/about |
Legal business disclaimers:     http://www.CraneSoftwrights.com/legal |



Received on Saturday, 26 September 2015 15:07:24 UTC

This archive was generated by hypermail 2.3.1 : Saturday, 26 September 2015 15:07:25 UTC