Re: Place image at top of page

"Szeak (Register Man)" <[email protected]>
Newsgroups gmane.text.xml.fop.user
Message-ID <[email protected]>
Hi, Michel!

What i think is,

If you can define the image (what need to put on the top of a new page) 
on the right place between paragraphs, than maybe the result will be good.
So, ie.

<fo:block>1. par</fo:block>
<fo:block>2. par</fo:block>
<fo:block>3. par</fo:block>
<fo:block break-before="page">Figure x ... 
<fo:external-graphic>...</fo:block>
<fo:block>4. par</fo:block>
<fo:block>5. par</fo:block>
<fo:block break-before="page">Figure x ... 
<fo:external-graphic>...</fo:block>

The first and second image containing blocks (which have the 
break-before attributes) are placed on top first on a new page.

This is the forced page break solution, and you don't need any complex 
page-master definition or "header" (fo:static-content) for this.

May this help for you.

Szeak

2016-11-28 13:18 keltezéssel, Michel Krämer írta:
>> If you want displaying the image exactly on top of the second page?
> Yes, that's what I want! :-) I want to place an image at the top of a page, no matter how many paragraphs I have. I want to place it at the top of the very page, where I put the image, just like you do it in latex with
>
> begin{figure}[t!]
> …
> \end{figure}
>
>> I can help you in this.
> That's very much appreciated. Thank you so much!
>
> Michel
>
>
>> On 28 Nov 2016, at 13:07, Szeak (Register Man) <[email protected]> wrote:
>>
>> Hi,
>>
>> If you want placing the image after 20. paragraph, why define it between 22. and 23?
>> Or
>> If you want displaying the image exactly on top of the second page?
>>
>> So if you want displaying the image exactly on top of the second page:
>> You need to define a bit more complex page-masters as now. I can help you in this.
>>
>> Don't hesitate to answer.
>>
>> Bye, Szeak
>>
>> 2016-11-28 12:21 keltezéssel, Michel Krämer írta:
>>> Hi Szeak,
>>>
>>> Thanks a lot! This sounds very promising indeed. I can't get it to work, however.
>>>
>>> If I put <fo:flow flow-name="xsl-region-before"> inside my page-sequence definition I get the following error:
>>>
>>> org.apache.fop.fo.ValidationException: For "fo:page-sequence", only one "fo:flow" may be declared. (See position 222:48)
>>>
>>> If I create a new page-sequence and put it there FOP will end up in an endless loop and won't stop generating pages.
>>>
>>> I'm not sure this is the right way, although it really sounds promising. Maybe I'm just missing something. I uploaded my small example here:
>>>
>>> https://gist.github.com/michel-kraemer/af82f3e115afb877338a72fa34a539cf
>>>
>>> If you render it you'll see that there is an image between paragraphs 22 and 23. You'll also see that paragraph 20 breaks at the end of page 1 and continues at page 2. I want to place the image at the top of page two, so right in the middle of paragraph 20.
>>>
>>> Any ideas?
>>>
>>> Thanks for your help!
>>>
>>> Michel
>>>
>>>
>>>
>>>> On 28 Nov 2016, at 11:48, Szeak (Register Man) <[email protected]> wrote:
>>>>
>>>> Hi,
>>>>
>>>> I don't think you need any code modifing in Java.
>>>> It seems, you need a header for the page, if i understand good your needs..
>>>>
>>>> So for display header correctly, you need to:
>>>> 1. define an ie.: <fo:region-before extent="1in"/> in simple-page-master definiton
>>>>     you can define an exact name for it ie.: <fo:region-before region-name="myHeader" extent="1in"/>
>>>> 2. define an <fo:flow flow-name="xsl-region-before"> in page-sequence definition
>>>>     you can use the named definition by: <fo:flow flow-name="myHeader">
>>>>
>>>> That's it.
>>>>
>>>> Bye, Szeak
>>>>
>>>> 2016-11-25 17:11 keltezéssel, Michel Krämer írta:
>>>>> Hi!
>>>>>
>>>>> I'm looking for a way to place an image at the top of the page, just like you can do it in LaTeX:
>>>>>
>>>>> \begin{figure}[t!]
>>>>>    ...
>>>>> \end{figure}
>>>>>
>>>>> If I understand it correctly, you should be able to do this with the fo:float object:
>>>>>
>>>>> <fo:float float="before">
>>>>>    ...
>>>>> </fo:float>
>>>>>
>>>>> I understand that FOP does not support the "before" value yet.
>>>>>
>>>>> Is there a workaround to achieve the same thing? For example by placing the image absolutely or something like that?
>>>>>
>>>>> I had a look at the code and it seems the feature is almost implemented but not fully yet. There is a BeforeFloat class that is supposed to place blocks in the before-float area, but even if I use <fo:float float="before"> this class never receives any children. The float also disappears from the output PDF.
>>>>>
>>>>> If there is no workaround for my problem I would be very interested to implement the solution myself. I'm a Java programmer and if anyone could give me some pointers on where to start and what is missing in the current code I'd probably be able to fill the gaps.
>>>>>
>>>>> Let me know what you think. Thank you so much!
>>>>>
>>>>> Cheers,
>>>>> Michel
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: [email protected]
>>>>> For additional commands, e-mail: [email protected]
>>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: [email protected]
>>>> For additional commands, e-mail: [email protected]
>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [email protected]
>>> For additional commands, e-mail: [email protected]
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.