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 Wessel van Norel <we...@ddnh.nl> on 2003/07/04 20:14:37 UTC
Page-height scales image?
Hi,
I'm using FOP atm to create PDF previews for a client of my company. The
PDF previews are based on a template with for example a header and a
footer and a certain markup for the text.
Now I encounter a problem that I'm not able to explain. I have a header
image which has a fixed height and width (defined in the XSL file). But
this image is not displayed correctly if my page height is below a
certain value. The page height is given in the XML input, since the
template does not know how large it is going to be.
With excactly the same input, besides page-height, the image differs in
size (it's being scaled).
I've put a border around the block where the image is put in. This
border also increases in height when the image height increases.
With FOP 0.20.4 (which we are using in production) the area tree output
shows no difference. But the image size and with that the size of the
border differs with page-heights from 90mm to 119mm. 90mm is
approximately the minimum, otherwise the content does not fit and FOP
will generate an unlimited number of pages.
When the page-height is higher then this the image does not get bigger.
The same happens with FOP 0.20.5rc3a.
I've used both JPEG and PNG. No difference with them. So this can rule
out JIMI problems if I'm correct.
The weirdest part is that the text below the header image is shown on
excactly the same place, even though the image is scaled. I place the
header in the region-before and the text below in the region-body.
I've also tried PS output. But it's the same. The image is scaled, but
when you lay the two pages on top of each other and the start positions
of the images on the same place, the text below the image is at excactly
the same place.
I've not attached the PDF previews and XML + XSL files, since this is a
mailing list. But if you think you can help me out I'm more then willing
to send you the examples + input.
I hope I've given a clear enough explanation of my problem. If you have
any questions about this, please contact me.
Regards
Wessel van Norel
P.S. can it be that the FOP 0.20.4 Area Tree generation does not work
when I run it like this from my JAVA class:
Driver driver = new Driver();
driver.setLogger(log);
driver.setRenderer(Driver.RENDER_XML);
driver.setOutputStream(pdfFile);
driver.render(handler.getParser(), handler.getInputSource());
I get a "java.lang.NullPointerException" when I do it, but when I change
it from Driver.RENDER_XML to Driver.RENDER_PDF it works...
When I save the generated XML and use FOP from the command line it
generates an area tree for me. No nullpointer exception.
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org
Re: Page-height scales image?
Posted by Wessel van Norel <we...@ddnh.nl>.
J.Pietschmann wrote:
> See bug #20868: ExternalGraphics.java, line 209 or so:
> int pageHeight = area.getPage().getBody().getMaxHeight()
> ^^^^^^^^^^^^^^^
> should be something else.
>
> J.Pietschmann
Thanks. We have looked into the bug report, and changed, after some
checks, our code also to:
int pageHeight = area.spaceLeft()
Since this also gives us the most desired behavour.
We have checked it with a graphic in a block-container and with a normal
positioned external graphic and it worked excactly as we wanted it to.
SpaceLeft also takes margins into account, so the image is scaled to the
real size that it can fill (in our case it's no longer scaled).
If the region getMaxHeight() is needed (I assume there must ge a reason
why teh getPage().getBody() check is in there), perhaps the function:
area.getNearestAncestorAreaContainer()
can help out, allthough you should check if you have a parent then,
since a block-container has no parent and the function does not check if
the parent is set. But I don't know what the desired behavour is for a
block container in this case.
Regards
Wessel van Norel
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org
Re: Page-height scales image?
Posted by "J.Pietschmann" <j3...@yahoo.de>.
Wessel van Norel wrote:
> If I'll need to search for the bug, can you perhaps give me a hint where
> to look?
See bug #20868: ExternalGraphics.java, line 209 or so:
int pageHeight = area.getPage().getBody().getMaxHeight()
^^^^^^^^^^^^^^^
should be something else.
J.Pietschmann
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org
Re: Page-height scales image?
Posted by Wessel van Norel <we...@ddnh.nl>.
J.Pietschmann wrote:
> There's a bug, the image is scaled down according to the height
> of the body region, which does no good if it goes into another
> region which is actually larger than the body.
> No workaround, except "don't do this". I don't think it will be
> fixed soon.
>
> J.Pietschmann
But to be able to generate 2 or more columns in a page you need to use
column-count and column-gap, if I'm correct. And when you want a header
and footer that go over all columns the only way I found was using the
region-before and region-after. And I don't want some empty space
between the end of my text and the footer. So just increasing the region
body size won't work for me.
So I'll probably have to search for the bug, correct? Or is there
another way to get content to go over more then one column, with a fixed
header and footer?
If I'll need to search for the bug, can you perhaps give me a hint where
to look?
Regards
Wessel van Norel
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org
Re: Page-height scales image?
Posted by "J.Pietschmann" <j3...@yahoo.de>.
Wessel van Norel wrote:
> Now I encounter a problem that I'm not able to explain. I have a header
> image which has a fixed height and width (defined in the XSL file). But
> this image is not displayed correctly if my page height is below a
> certain value. The page height is given in the XML input, since the
> template does not know how large it is going to be.
> With excactly the same input, besides page-height, the image differs in
> size (it's being scaled).
There's a bug, the image is scaled down according to the height
of the body region, which does no good if it goes into another
region which is actually larger than the body.
No workaround, except "don't do this". I don't think it will be
fixed soon.
J.Pietschmann
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org