Re: [xsl] [XSL-FO] Linebreaks on a page break (linefeed-treatment)

Subject: Re: [xsl] [XSL-FO] Linebreaks on a page break (linefeed-treatment)
From: "Mathias Leclercq mathias.leclercq@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 28 Jun 2018 14:06:44 -0000
Hello Peter,

Unfortunately, I'm stuck with the FO.

The third-party program that generates the XML based on users' input (in
forms) only accepts XSL files to output PDF and it works with FOP and
who-know-what XSLT engine. The users don't have access to other programs but
that one so I cannot bypass it.

> That is always a problem, regardless of the PDF formatter in use: the
specification says "one page" but the user has given >1 page of text.

What do you mean by that? Where in specifications of Apache FOP is it said
that XML text() cannot be bigger than one page?
Because if there's no line break during page break, no issue occurs, i.e. if
it is plain text without line break AT THE END OF PAGE, it can span as many
pages as it wants.

Thank you anyway for your kind offer.
Best regards

-----Original Message-----
From: Peter Flynn <peter@xxxxxxxxxxx>
Sent: Thursday, June 28, 2018 11:06 AM
To: Mathias Leclercq <Mathias.Leclercq@xxxxxxxxx>
Subject: Re: [xsl] [XSL-FO] Linebreaks on a page break (linefeed-treatment)

On 28/06/18 07:33, Mathias Leclercq mathias.leclercq@xxxxxxxxx wrote:
> Hi everyone,
> I'm using XSL-T and XSL-FO to produce PDF (A4) reports using data from
> forms filled by user in a third-party software (that output XML).
> Users can have any sorts of input, included large text area they can
> fill as they want (no control over the content size).

Have you looked at using XSLT wth LaTeX instead of FO? This will also generate
PDF, and it provides better programmable access to the formatting.

> The issue I came across is that whenever the text area is filled with
> enough data to cause a page break, and when there are linebreaks at
> the exact moment the page break occurs, the FOP processor issues a
> null pointer exception. Below is the part of the XSL-FO that is
> causing an issue.

LaTeX discards unwanted or unusable vertical white-space if it occurs at a
page-break, so this problem does not occur.

> The linefeed-treatment="preserve" is to keep the format from the form
> to the PDF and the keep-together.within-page="always" ("auto"
> here to show the issue) is a workaround I found to resolve this issue
> but that I cannot keep because data is lost when the text span more
> than 1 page.

That is always a problem, regardless of the PDF formatter in use: the
specification says "one page" but the user has given >1 page of text.

> Is there a problem somewhere in my code? is it related to the FOP processor?
I will leave this to the FO experts to answer.

If you would like us to look at a solution using LaTeX we would be happy to do
a test free of charge.

///Peter Flynn
Peter Flynn | Principal Consultant | Silmaril Consultants | Cork p.p*
Ireland | b +353 86 824 5333 | b	 peter@xxxxxxxxxxx | p

Current Thread