Place image at top of page

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
17 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Place image at top of page

Michel Krämer
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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Place image at top of page

Szeak (Register Man)
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: [hidden email]
> For additional commands, e-mail: [hidden email]
>


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

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Place image at top of page

Michel Krämer
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) <[hidden email]> 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: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>


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

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Place image at top of page

Szeak (Register Man)
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) <[hidden email]> 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: [hidden email]
>>> For additional commands, e-mail: [hidden email]
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>


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

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Place image at top of page

Michel Krämer
> 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) <[hidden email]> 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) <[hidden email]> 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: [hidden email]
>>>> For additional commands, e-mail: [hidden email]
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [hidden email]
>>> For additional commands, e-mail: [hidden email]
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>


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

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Place image at top of page

Szeak (Register Man)
Hi,

My solution for your need is:

<fo:layout-master-set>
         <fo:simple-page-master master-name="content"
page-height="297mm" page-width="210mm" margin="0.2in">
             <fo:region-body>
             </fo:region-body>
         </fo:simple-page-master>
         <fo:simple-page-master master-name="content-with-header"
page-height="297mm" page-width="210mm" margin="0.2in">
             <fo:region-body margin-top="2.5in"/>
             <fo:region-before extent="2.5in"/>
         </fo:simple-page-master>

         <fo:page-sequence-master master-name="mixed-content">
             <fo:single-page-master-reference master-reference="content"/>
             <fo:single-page-master-reference
master-reference="content-with-header"/>
             <fo:repeatable-page-master-reference
master-reference="content"/>
         </fo:page-sequence-master>
     </fo:layout-master-set>
     <fo:page-sequence master-reference="mixed-content">
         <fo:static-content flow-name="xsl-region-before">
             <fo:block font-size="11pt" font-style="italic"
font-weight="normal" hyphenate="false"
keep-with-previous.within-column="always"
line-stacking-strategy="font-height" space-after.maximum="1.7em"
space-after.minimum="1.3em" space-after.optimum="1.5em"
space-before.maximum="0em" space-before.minimum="0em"
space-before.optimum="0em" text-indent="0pt">
                 Figure 3.1 Layers of code in a complex software
architecture
             </fo:block>
             <fo:block background-color="red" id="img-layers-of-code"
keep-together.within-column="always" text-align="center">
                 <fo:block id="d69e465" text-align="center">
                     <fo:external-graphic content-height="auto"
content-width="66%" height="auto"
src="url(https://placeholdit.imgix.net/~text?txtsize=33&amp;txt=350%C3%97150&amp;w=350&amp;h=150&amp;fm=png)"
width="auto">
                     </fo:external-graphic>
                 </fo:block>
                 <fo:block font-size="11pt" font-style="italic"
font-weight="normal" hyphenate="false"
keep-with-previous.within-column="always"
line-stacking-strategy="font-height" space-after.maximum="1.7em"
space-after.minimum="1.3em" space-after.optimum="1.5em"
space-before.maximum="0em" space-before.minimum="0em"
space-before.optimum="0em" text-indent="0pt">
                     Figure 1 Lorem ipsum dolor sit amet
                 </fo:block>
             </fo:block>
         </fo:static-content>
         <fo:flow flow-name="xsl-region-body">

....  the content of body

Bye

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) <[hidden email]> 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) <[hidden email]> 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: [hidden email]
>>>>> For additional commands, e-mail: [hidden email]
>>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: [hidden email]
>>>> For additional commands, e-mail: [hidden email]
>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [hidden email]
>>> For additional commands, e-mail: [hidden email]
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>


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

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Place image at top of page

Michel Krämer
Hi Szeak!

This works! Thank you so much.

Do I understand it correctly that I need to know in advance on which page my figure appears? So if I need it on page 100 I will have to repeat <fo:single-page-master-reference master-reference="content"/> 99 times?

I'm asking because I'm generating a rather large document from DocBook using XSLT. There are many figures on different pages and I want to put some of them to the top of their respective page. I guess there is no easy solution for this with FOP, right?

Michel


> On 28 Nov 2016, at 14:04, Szeak (Register Man) <[hidden email]> wrote:
>
> Hi,
>
> My solution for your need is:
>
> <fo:layout-master-set>
>        <fo:simple-page-master master-name="content" page-height="297mm" page-width="210mm" margin="0.2in">
>            <fo:region-body>
>            </fo:region-body>
>        </fo:simple-page-master>
>        <fo:simple-page-master master-name="content-with-header" page-height="297mm" page-width="210mm" margin="0.2in">
>            <fo:region-body margin-top="2.5in"/>
>            <fo:region-before extent="2.5in"/>
>        </fo:simple-page-master>
>
>        <fo:page-sequence-master master-name="mixed-content">
>            <fo:single-page-master-reference master-reference="content"/>
>            <fo:single-page-master-reference master-reference="content-with-header"/>
>            <fo:repeatable-page-master-reference master-reference="content"/>
>        </fo:page-sequence-master>
>    </fo:layout-master-set>
>    <fo:page-sequence master-reference="mixed-content">
>        <fo:static-content flow-name="xsl-region-before">
>            <fo:block font-size="11pt" font-style="italic" font-weight="normal" hyphenate="false" keep-with-previous.within-column="always" line-stacking-strategy="font-height" space-after.maximum="1.7em" space-after.minimum="1.3em" space-after.optimum="1.5em" space-before.maximum="0em" space-before.minimum="0em" space-before.optimum="0em" text-indent="0pt">
>                Figure 3.1 Layers of code in a complex software architecture
>            </fo:block>
>            <fo:block background-color="red" id="img-layers-of-code" keep-together.within-column="always" text-align="center">
>                <fo:block id="d69e465" text-align="center">
>                    <fo:external-graphic content-height="auto" content-width="66%" height="auto" src="url(https://placeholdit.imgix.net/~text?txtsize=33&amp;txt=350%C3%97150&amp;w=350&amp;h=150&amp;fm=png)" width="auto">
>                    </fo:external-graphic>
>                </fo:block>
>                <fo:block font-size="11pt" font-style="italic" font-weight="normal" hyphenate="false" keep-with-previous.within-column="always" line-stacking-strategy="font-height" space-after.maximum="1.7em" space-after.minimum="1.3em" space-after.optimum="1.5em" space-before.maximum="0em" space-before.minimum="0em" space-before.optimum="0em" text-indent="0pt">
>                    Figure 1 Lorem ipsum dolor sit amet
>                </fo:block>
>            </fo:block>
>        </fo:static-content>
>        <fo:flow flow-name="xsl-region-body">
>
> ....  the content of body
>
> Bye
>
> 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) <[hidden email]> 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) <[hidden email]> 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: [hidden email]
>>>>>> For additional commands, e-mail: [hidden email]
>>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: [hidden email]
>>>>> For additional commands, e-mail: [hidden email]
>>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: [hidden email]
>>>> For additional commands, e-mail: [hidden email]
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [hidden email]
>>> For additional commands, e-mail: [hidden email]
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>


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

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Place image at top of page

Michel Krämer
… You know, it would be great if there was something like a footnote, just for the top of the page! :-) That would actually be what I need. :-)

Michel


> On 28 Nov 2016, at 15:44, Michel Krämer <[hidden email]> wrote:
>
> Hi Szeak!
>
> This works! Thank you so much.
>
> Do I understand it correctly that I need to know in advance on which page my figure appears? So if I need it on page 100 I will have to repeat <fo:single-page-master-reference master-reference="content"/> 99 times?
>
> I'm asking because I'm generating a rather large document from DocBook using XSLT. There are many figures on different pages and I want to put some of them to the top of their respective page. I guess there is no easy solution for this with FOP, right?
>
> Michel
>
>
>> On 28 Nov 2016, at 14:04, Szeak (Register Man) <[hidden email]> wrote:
>>
>> Hi,
>>
>> My solution for your need is:
>>
>> <fo:layout-master-set>
>>       <fo:simple-page-master master-name="content" page-height="297mm" page-width="210mm" margin="0.2in">
>>           <fo:region-body>
>>           </fo:region-body>
>>       </fo:simple-page-master>
>>       <fo:simple-page-master master-name="content-with-header" page-height="297mm" page-width="210mm" margin="0.2in">
>>           <fo:region-body margin-top="2.5in"/>
>>           <fo:region-before extent="2.5in"/>
>>       </fo:simple-page-master>
>>
>>       <fo:page-sequence-master master-name="mixed-content">
>>           <fo:single-page-master-reference master-reference="content"/>
>>           <fo:single-page-master-reference master-reference="content-with-header"/>
>>           <fo:repeatable-page-master-reference master-reference="content"/>
>>       </fo:page-sequence-master>
>>   </fo:layout-master-set>
>>   <fo:page-sequence master-reference="mixed-content">
>>       <fo:static-content flow-name="xsl-region-before">
>>           <fo:block font-size="11pt" font-style="italic" font-weight="normal" hyphenate="false" keep-with-previous.within-column="always" line-stacking-strategy="font-height" space-after.maximum="1.7em" space-after.minimum="1.3em" space-after.optimum="1.5em" space-before.maximum="0em" space-before.minimum="0em" space-before.optimum="0em" text-indent="0pt">
>>               Figure 3.1 Layers of code in a complex software architecture
>>           </fo:block>
>>           <fo:block background-color="red" id="img-layers-of-code" keep-together.within-column="always" text-align="center">
>>               <fo:block id="d69e465" text-align="center">
>>                   <fo:external-graphic content-height="auto" content-width="66%" height="auto" src="url(https://placeholdit.imgix.net/~text?txtsize=33&amp;txt=350%C3%97150&amp;w=350&amp;h=150&amp;fm=png)" width="auto">
>>                   </fo:external-graphic>
>>               </fo:block>
>>               <fo:block font-size="11pt" font-style="italic" font-weight="normal" hyphenate="false" keep-with-previous.within-column="always" line-stacking-strategy="font-height" space-after.maximum="1.7em" space-after.minimum="1.3em" space-after.optimum="1.5em" space-before.maximum="0em" space-before.minimum="0em" space-before.optimum="0em" text-indent="0pt">
>>                   Figure 1 Lorem ipsum dolor sit amet
>>               </fo:block>
>>           </fo:block>
>>       </fo:static-content>
>>       <fo:flow flow-name="xsl-region-body">
>>
>> ....  the content of body
>>
>> Bye
>>
>> 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) <[hidden email]> 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) <[hidden email]> 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: [hidden email]
>>>>>>> For additional commands, e-mail: [hidden email]
>>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: [hidden email]
>>>>>> For additional commands, e-mail: [hidden email]
>>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: [hidden email]
>>>>> For additional commands, e-mail: [hidden email]
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: [hidden email]
>>>> For additional commands, e-mail: [hidden email]
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [hidden email]
>>> For additional commands, e-mail: [hidden email]
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>


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

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Place image at top of page

Frank Hirsch
What Szeak describes is a valid option - still it does require to „break“ the flow if I well understand the requirement (based on master)?
Maybe using an absolute positioned block element which is anchored to the related information might as well be a possible option?

Thus the figure should appear on whatever page the related text will be rendered…

Just an idea,
Frank


Am 28.11.2016 um 15:51 schrieb Michel Krämer <[hidden email]>:

… You know, it would be great if there was something like a footnote, just for the top of the page! :-) That would actually be what I need. :-)

Michel


On 28 Nov 2016, at 15:44, Michel Krämer <[hidden email]> wrote:

Hi Szeak!

This works! Thank you so much.

Do I understand it correctly that I need to know in advance on which page my figure appears? So if I need it on page 100 I will have to repeat <fo:single-page-master-reference master-reference="content"/> 99 times?

I'm asking because I'm generating a rather large document from DocBook using XSLT. There are many figures on different pages and I want to put some of them to the top of their respective page. I guess there is no easy solution for this with FOP, right?

Michel


On 28 Nov 2016, at 14:04, Szeak (Register Man) <[hidden email]> wrote:

Hi,

My solution for your need is:

<fo:layout-master-set>
     <fo:simple-page-master master-name="content" page-height="297mm" page-width="210mm" margin="0.2in">
         <fo:region-body>
         </fo:region-body>
     </fo:simple-page-master>
     <fo:simple-page-master master-name="content-with-header" page-height="297mm" page-width="210mm" margin="0.2in">
         <fo:region-body margin-top="2.5in"/>
         <fo:region-before extent="2.5in"/>
     </fo:simple-page-master>

     <fo:page-sequence-master master-name="mixed-content">
         <fo:single-page-master-reference master-reference="content"/>
         <fo:single-page-master-reference master-reference="content-with-header"/>
         <fo:repeatable-page-master-reference master-reference="content"/>
     </fo:page-sequence-master>
 </fo:layout-master-set>
 <fo:page-sequence master-reference="mixed-content">
     <fo:static-content flow-name="xsl-region-before">
         <fo:block font-size="11pt" font-style="italic" font-weight="normal" hyphenate="false" keep-with-previous.within-column="always" line-stacking-strategy="font-height" space-after.maximum="1.7em" space-after.minimum="1.3em" space-after.optimum="1.5em" space-before.maximum="0em" space-before.minimum="0em" space-before.optimum="0em" text-indent="0pt">
             Figure 3.1 Layers of code in a complex software architecture
         </fo:block>
         <fo:block background-color="red" id="img-layers-of-code" keep-together.within-column="always" text-align="center">
             <fo:block id="d69e465" text-align="center">
                 <fo:external-graphic content-height="auto" content-width="66%" height="auto" src="url(https://placeholdit.imgix.net/~text?txtsize=33&amp;txt=350%C3%97150&amp;w=350&amp;h=150&amp;fm=png)" width="auto">
                 </fo:external-graphic>
             </fo:block>
             <fo:block font-size="11pt" font-style="italic" font-weight="normal" hyphenate="false" keep-with-previous.within-column="always" line-stacking-strategy="font-height" space-after.maximum="1.7em" space-after.minimum="1.3em" space-after.optimum="1.5em" space-before.maximum="0em" space-before.minimum="0em" space-before.optimum="0em" text-indent="0pt">
                 Figure 1 Lorem ipsum dolor sit amet
             </fo:block>
         </fo:block>
     </fo:static-content>
     <fo:flow flow-name="xsl-region-body">

....  the content of body

Bye

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) <[hidden email]> 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) <[hidden email]> 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: [hidden email]
For additional commands, e-mail: [hidden email]

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

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


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


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



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




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


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Place image at top of page

Michel Krämer
Frank,

Thanks for your answer! I was thinking about this too, but the figure would overlay the text (or the other way around). The text would not flow around the figure (or continue after the figure in my case).

That's why I was referring to <fo:float float="before"> in the first place. If I understand it correctly this should be the element that does what I need, but it's not implemented in FOP yet.

Michel


> On 28 Nov 2016, at 16:03, Frank Hirsch <[hidden email]> wrote:
>
> What Szeak describes is a valid option - still it does require to „break“ the flow if I well understand the requirement (based on master)?
> Maybe using an absolute positioned block element which is anchored to the related information might as well be a possible option?
> https://www.data2type.de/xml/foref.html#absolute-position
>
> Thus the figure should appear on whatever page the related text will be rendered…
>
> Just an idea,
> Frank
>
>
>> Am 28.11.2016 um 15:51 schrieb Michel Krämer <[hidden email]>:
>>
>> … You know, it would be great if there was something like a footnote, just for the top of the page! :-) That would actually be what I need. :-)
>>
>> Michel
>>
>>
>>> On 28 Nov 2016, at 15:44, Michel Krämer <[hidden email]> wrote:
>>>
>>> Hi Szeak!
>>>
>>> This works! Thank you so much.
>>>
>>> Do I understand it correctly that I need to know in advance on which page my figure appears? So if I need it on page 100 I will have to repeat <fo:single-page-master-reference master-reference="content"/> 99 times?
>>>
>>> I'm asking because I'm generating a rather large document from DocBook using XSLT. There are many figures on different pages and I want to put some of them to the top of their respective page. I guess there is no easy solution for this with FOP, right?
>>>
>>> Michel
>>>
>>>
>>>> On 28 Nov 2016, at 14:04, Szeak (Register Man) <[hidden email]> wrote:
>>>>
>>>> Hi,
>>>>
>>>> My solution for your need is:
>>>>
>>>> <fo:layout-master-set>
>>>>      <fo:simple-page-master master-name="content" page-height="297mm" page-width="210mm" margin="0.2in">
>>>>          <fo:region-body>
>>>>          </fo:region-body>
>>>>      </fo:simple-page-master>
>>>>      <fo:simple-page-master master-name="content-with-header" page-height="297mm" page-width="210mm" margin="0.2in">
>>>>          <fo:region-body margin-top="2.5in"/>
>>>>          <fo:region-before extent="2.5in"/>
>>>>      </fo:simple-page-master>
>>>>
>>>>      <fo:page-sequence-master master-name="mixed-content">
>>>>          <fo:single-page-master-reference master-reference="content"/>
>>>>          <fo:single-page-master-reference master-reference="content-with-header"/>
>>>>          <fo:repeatable-page-master-reference master-reference="content"/>
>>>>      </fo:page-sequence-master>
>>>>  </fo:layout-master-set>
>>>>  <fo:page-sequence master-reference="mixed-content">
>>>>      <fo:static-content flow-name="xsl-region-before">
>>>>          <fo:block font-size="11pt" font-style="italic" font-weight="normal" hyphenate="false" keep-with-previous.within-column="always" line-stacking-strategy="font-height" space-after.maximum="1.7em" space-after.minimum="1.3em" space-after.optimum="1.5em" space-before.maximum="0em" space-before.minimum="0em" space-before.optimum="0em" text-indent="0pt">
>>>>              Figure 3.1 Layers of code in a complex software architecture
>>>>          </fo:block>
>>>>          <fo:block background-color="red" id="img-layers-of-code" keep-together.within-column="always" text-align="center">
>>>>              <fo:block id="d69e465" text-align="center">
>>>>                  <fo:external-graphic content-height="auto" content-width="66%" height="auto" src="url(https://placeholdit.imgix.net/~text?txtsize=33&amp;txt=350%C3%97150&amp;w=350&amp;h=150&amp;fm=png)" width="auto">
>>>>                  </fo:external-graphic>
>>>>              </fo:block>
>>>>              <fo:block font-size="11pt" font-style="italic" font-weight="normal" hyphenate="false" keep-with-previous.within-column="always" line-stacking-strategy="font-height" space-after.maximum="1.7em" space-after.minimum="1.3em" space-after.optimum="1.5em" space-before.maximum="0em" space-before.minimum="0em" space-before.optimum="0em" text-indent="0pt">
>>>>                  Figure 1 Lorem ipsum dolor sit amet
>>>>              </fo:block>
>>>>          </fo:block>
>>>>      </fo:static-content>
>>>>      <fo:flow flow-name="xsl-region-body">
>>>>
>>>> ....  the content of body
>>>>
>>>> Bye
>>>>
>>>> 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) <[hidden email]> 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) <[hidden email]> 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: [hidden email]
>>>>>>>>> For additional commands, e-mail: [hidden email]
>>>>>>>>>
>>>>>>>> ---------------------------------------------------------------------
>>>>>>>> To unsubscribe, e-mail: [hidden email]
>>>>>>>> For additional commands, e-mail: [hidden email]
>>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: [hidden email]
>>>>>>> For additional commands, e-mail: [hidden email]
>>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: [hidden email]
>>>>>> For additional commands, e-mail: [hidden email]
>>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: [hidden email]
>>>>> For additional commands, e-mail: [hidden email]
>>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: [hidden email]
>>>> For additional commands, e-mail: [hidden email]
>>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>


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

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Place image at top of page

Szeak (Register Man)
In reply to this post by Michel Krämer

Hi

You have right. Só in fop the flow ás its name is nőt paged. It paginating át rendering time. You can using the sequences ás ie ms word but zhese can be more complex. You can also playing with forced page braking before or after a paragraph or block-container table etc.

Só you have many chamce tó do It bit you cannot put something exactly to a nimbered page becose fop not page oriented.

Bye szeak


2016. nov. 28. 15:44 ezt írta ("Michel Krämer" <[hidden email]>):
Hi Szeak!

This works! Thank you so much.

Do I understand it correctly that I need to know in advance on which page my figure appears? So if I need it on page 100 I will have to repeat <fo:single-page-master-reference master-reference="content"/> 99 times?

I'm asking because I'm generating a rather large document from DocBook using XSLT. There are many figures on different pages and I want to put some of them to the top of their respective page. I guess there is no easy solution for this with FOP, right?

Michel


> On 28 Nov 2016, at 14:04, Szeak (Register Man) <[hidden email]> wrote:
>
> Hi,
>
> My solution for your need is:
>
> <fo:layout-master-set>
>        <fo:simple-page-master master-name="content" page-height="297mm" page-width="210mm" margin="0.2in">
>            <fo:region-body>
>            </fo:region-body>
>        </fo:simple-page-master>
>        <fo:simple-page-master master-name="content-with-header" page-height="297mm" page-width="210mm" margin="0.2in">
>            <fo:region-body margin-top="2.5in"/>
>            <fo:region-before extent="2.5in"/>
>        </fo:simple-page-master>
>
>        <fo:page-sequence-master master-name="mixed-content">
>            <fo:single-page-master-reference master-reference="content"/>
>            <fo:single-page-master-reference master-reference="content-with-header"/>
>            <fo:repeatable-page-master-reference master-reference="content"/>
>        </fo:page-sequence-master>
>    </fo:layout-master-set>
>    <fo:page-sequence master-reference="mixed-content">
>        <fo:static-content flow-name="xsl-region-before">
>            <fo:block font-size="11pt" font-style="italic" font-weight="normal" hyphenate="false" keep-with-previous.within-column="always" line-stacking-strategy="font-height" space-after.maximum="1.7em" space-after.minimum="1.3em" space-after.optimum="1.5em" space-before.maximum="0em" space-before.minimum="0em" space-before.optimum="0em" text-indent="0pt">
>                Figure 3.1 Layers of code in a complex software architecture
>            </fo:block>
>            <fo:block background-color="red" id="img-layers-of-code" keep-together.within-column="always" text-align="center">
>                <fo:block id="d69e465" text-align="center">
>                    <fo:external-graphic content-height="auto" content-width="66%" height="auto" src="url(https://placeholdit.imgix.net/~text?txtsize=33&amp;txt=350%C3%97150&amp;w=350&amp;h=150&amp;fm=png)" width="auto">
>                    </fo:external-graphic>
>                </fo:block>
>                <fo:block font-size="11pt" font-style="italic" font-weight="normal" hyphenate="false" keep-with-previous.within-column="always" line-stacking-strategy="font-height" space-after.maximum="1.7em" space-after.minimum="1.3em" space-after.optimum="1.5em" space-before.maximum="0em" space-before.minimum="0em" space-before.optimum="0em" text-indent="0pt">
>                    Figure 1 Lorem ipsum dolor sit amet
>                </fo:block>
>            </fo:block>
>        </fo:static-content>
>        <fo:flow flow-name="xsl-region-body">
>
> ....  the content of body
>
> Bye
>
> 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) <[hidden email]> 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) <[hidden email]> 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: [hidden email]
>>>>>> For additional commands, e-mail: [hidden email]
>>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: [hidden email]
>>>>> For additional commands, e-mail: [hidden email]
>>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: [hidden email]
>>>> For additional commands, e-mail: [hidden email]
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [hidden email]
>>> For additional commands, e-mail: [hidden email]
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>


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


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Place image at top of page

Frank Hirsch
Sorry, I thought there would be a way to use fo:float and of:block. I tried myself and did not succeed.

Best,
Frank

Am 28.11.2016 um 17:10 schrieb Csaba Nánai <[hidden email]>:

Hi

You have right. Só in fop the flow ás its name is nőt paged. It paginating át rendering time. You can using the sequences ás ie ms word but zhese can be more complex. You can also playing with forced page braking before or after a paragraph or block-container table etc.

Só you have many chamce tó do It bit you cannot put something exactly to a nimbered page becose fop not page oriented.

Bye szeak


2016. nov. 28. 15:44 ezt írta ("Michel Krämer" <[hidden email]>):
Hi Szeak!

This works! Thank you so much.

Do I understand it correctly that I need to know in advance on which page my figure appears? So if I need it on page 100 I will have to repeat <fo:single-page-master-reference master-reference="content"/> 99 times?

I'm asking because I'm generating a rather large document from DocBook using XSLT. There are many figures on different pages and I want to put some of them to the top of their respective page. I guess there is no easy solution for this with FOP, right?

Michel


> On 28 Nov 2016, at 14:04, Szeak (Register Man) <[hidden email]> wrote:
>
> Hi,
>
> My solution for your need is:
>
> <fo:layout-master-set>
>        <fo:simple-page-master master-name="content" page-height="297mm" page-width="210mm" margin="0.2in">
>            <fo:region-body>
>            </fo:region-body>
>        </fo:simple-page-master>
>        <fo:simple-page-master master-name="content-with-header" page-height="297mm" page-width="210mm" margin="0.2in">
>            <fo:region-body margin-top="2.5in"/>
>            <fo:region-before extent="2.5in"/>
>        </fo:simple-page-master>
>
>        <fo:page-sequence-master master-name="mixed-content">
>            <fo:single-page-master-reference master-reference="content"/>
>            <fo:single-page-master-reference master-reference="content-with-header"/>
>            <fo:repeatable-page-master-reference master-reference="content"/>
>        </fo:page-sequence-master>
>    </fo:layout-master-set>
>    <fo:page-sequence master-reference="mixed-content">
>        <fo:static-content flow-name="xsl-region-before">
>            <fo:block font-size="11pt" font-style="italic" font-weight="normal" hyphenate="false" keep-with-previous.within-column="always" line-stacking-strategy="font-height" space-after.maximum="1.7em" space-after.minimum="1.3em" space-after.optimum="1.5em" space-before.maximum="0em" space-before.minimum="0em" space-before.optimum="0em" text-indent="0pt">
>                Figure 3.1 Layers of code in a complex software architecture
>            </fo:block>
>            <fo:block background-color="red" id="img-layers-of-code" keep-together.within-column="always" text-align="center">
>                <fo:block id="d69e465" text-align="center">
>                    <fo:external-graphic content-height="auto" content-width="66%" height="auto" src="url(https://placeholdit.imgix.net/~text?txtsize=33&amp;txt=350%C3%97150&amp;w=350&amp;h=150&amp;fm=png)" width="auto">
>                    </fo:external-graphic>
>                </fo:block>
>                <fo:block font-size="11pt" font-style="italic" font-weight="normal" hyphenate="false" keep-with-previous.within-column="always" line-stacking-strategy="font-height" space-after.maximum="1.7em" space-after.minimum="1.3em" space-after.optimum="1.5em" space-before.maximum="0em" space-before.minimum="0em" space-before.optimum="0em" text-indent="0pt">
>                    Figure 1 Lorem ipsum dolor sit amet
>                </fo:block>
>            </fo:block>
>        </fo:static-content>
>        <fo:flow flow-name="xsl-region-body">
>
> ....  the content of body
>
> Bye
>
> 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) <[hidden email]> 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) <[hidden email]> 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: [hidden email]
>>>>>> For additional commands, e-mail: [hidden email]
>>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: [hidden email]
>>>>> For additional commands, e-mail: [hidden email]
>>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: [hidden email]
>>>> For additional commands, e-mail: [hidden email]
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [hidden email]
>>> For additional commands, e-mail: [hidden email]
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>


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



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Place image at top of page

Michel Krämer
Frank,

Thanks for trying. It didn't work for me either. Here's an example that seems to work in other renderers but not in FOP:
http://www.herongyang.com/XSL-FO/Float-Add-xsl-before-float-Separator.html

That's why I said earlier I suspect the float-before thing is not fully implemented yet.

In the meantime I got it working with a really bad hack:
https://github.com/michel-kraemer/fop/commit/be163d8f103568bf63629e90949a95250ca29063

My code moves any footnote containing an image to the top of the page and moves the body down accordingly.

This hack is really bad however. The output "looks" exactly how I want it to at least, but I'll probably go to programmer's hell for this eventually. So, I'd rather like to do it right. Are there any FOP developers here on this mailing list or should I post to the dev list instead?

Michel


> On 28 Nov 2016, at 18:27, Frank Hirsch <[hidden email]> wrote:
>
> Sorry, I thought there would be a way to use fo:float and of:block. I tried myself and did not succeed.
>
> Best,
> Frank
>
>> Am 28.11.2016 um 17:10 schrieb Csaba Nánai <[hidden email]>:
>>
>> Hi
>>
>> You have right. Só in fop the flow ás its name is nőt paged. It paginating át rendering time. You can using the sequences ás ie ms word but zhese can be more complex. You can also playing with forced page braking before or after a paragraph or block-container table etc.
>>
>> Só you have many chamce tó do It bit you cannot put something exactly to a nimbered page becose fop not page oriented.
>>
>> Bye szeak
>>
>> 2016. nov. 28. 15:44 ezt írta ("Michel Krämer" <[hidden email]>):
>> Hi Szeak!
>>
>> This works! Thank you so much.
>>
>> Do I understand it correctly that I need to know in advance on which page my figure appears? So if I need it on page 100 I will have to repeat <fo:single-page-master-reference master-reference="content"/> 99 times?
>>
>> I'm asking because I'm generating a rather large document from DocBook using XSLT. There are many figures on different pages and I want to put some of them to the top of their respective page. I guess there is no easy solution for this with FOP, right?
>>
>> Michel
>>
>>
>> > On 28 Nov 2016, at 14:04, Szeak (Register Man) <[hidden email]> wrote:
>> >
>> > Hi,
>> >
>> > My solution for your need is:
>> >
>> > <fo:layout-master-set>
>> >        <fo:simple-page-master master-name="content" page-height="297mm" page-width="210mm" margin="0.2in">
>> >            <fo:region-body>
>> >            </fo:region-body>
>> >        </fo:simple-page-master>
>> >        <fo:simple-page-master master-name="content-with-header" page-height="297mm" page-width="210mm" margin="0.2in">
>> >            <fo:region-body margin-top="2.5in"/>
>> >            <fo:region-before extent="2.5in"/>
>> >        </fo:simple-page-master>
>> >
>> >        <fo:page-sequence-master master-name="mixed-content">
>> >            <fo:single-page-master-reference master-reference="content"/>
>> >            <fo:single-page-master-reference master-reference="content-with-header"/>
>> >            <fo:repeatable-page-master-reference master-reference="content"/>
>> >        </fo:page-sequence-master>
>> >    </fo:layout-master-set>
>> >    <fo:page-sequence master-reference="mixed-content">
>> >        <fo:static-content flow-name="xsl-region-before">
>> >            <fo:block font-size="11pt" font-style="italic" font-weight="normal" hyphenate="false" keep-with-previous.within-column="always" line-stacking-strategy="font-height" space-after.maximum="1.7em" space-after.minimum="1.3em" space-after.optimum="1.5em" space-before.maximum="0em" space-before.minimum="0em" space-before.optimum="0em" text-indent="0pt">
>> >                Figure 3.1 Layers of code in a complex software architecture
>> >            </fo:block>
>> >            <fo:block background-color="red" id="img-layers-of-code" keep-together.within-column="always" text-align="center">
>> >                <fo:block id="d69e465" text-align="center">
>> >                    <fo:external-graphic content-height="auto" content-width="66%" height="auto" src="url(https://placeholdit.imgix.net/~text?txtsize=33&amp;txt=350%C3%97150&amp;w=350&amp;h=150&amp;fm=png)" width="auto">
>> >                    </fo:external-graphic>
>> >                </fo:block>
>> >                <fo:block font-size="11pt" font-style="italic" font-weight="normal" hyphenate="false" keep-with-previous.within-column="always" line-stacking-strategy="font-height" space-after.maximum="1.7em" space-after.minimum="1.3em" space-after.optimum="1.5em" space-before.maximum="0em" space-before.minimum="0em" space-before.optimum="0em" text-indent="0pt">
>> >                    Figure 1 Lorem ipsum dolor sit amet
>> >                </fo:block>
>> >            </fo:block>
>> >        </fo:static-content>
>> >        <fo:flow flow-name="xsl-region-body">
>> >
>> > ....  the content of body
>> >
>> > Bye
>> >
>> > 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) <[hidden email]> 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) <[hidden email]> 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: [hidden email]
>> >>>>>> For additional commands, e-mail: [hidden email]
>> >>>>>>
>> >>>>> ---------------------------------------------------------------------
>> >>>>> To unsubscribe, e-mail: [hidden email]
>> >>>>> For additional commands, e-mail: [hidden email]
>> >>>>>
>> >>>> ---------------------------------------------------------------------
>> >>>> To unsubscribe, e-mail: [hidden email]
>> >>>> For additional commands, e-mail: [hidden email]
>> >>>>
>> >>>
>> >>> ---------------------------------------------------------------------
>> >>> To unsubscribe, e-mail: [hidden email]
>> >>> For additional commands, e-mail: [hidden email]
>> >>>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: [hidden email]
>> >> For additional commands, e-mail: [hidden email]
>> >>
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: [hidden email]
>> > For additional commands, e-mail: [hidden email]
>> >
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>>
>


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

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Place image at top of page

Frank Hirsch
Hi Michael,

If it works for you it might be a valid solution - I once did setup a project based on fop 1.0, I never had a requirement to update... but I am not an expert when it comes down to customization. At least I would not send you to hell ;-)

What I also did to achieve something I was not able to solve in FO (run tables across double page) was to use Area Tree: the FO was built on DIN A3 master pages and the cut into DIN A4 in a post process... But using the hack seems much more plausible to me in your case?

Best,
Frank

> Am 29.11.2016 um 07:34 schrieb Michel Krämer <[hidden email]>:
>
> Frank,
>
> Thanks for trying. It didn't work for me either. Here's an example that seems to work in other renderers but not in FOP:
> http://www.herongyang.com/XSL-FO/Float-Add-xsl-before-float-Separator.html
>
> That's why I said earlier I suspect the float-before thing is not fully implemented yet.
>
> In the meantime I got it working with a really bad hack:
> https://github.com/michel-kraemer/fop/commit/be163d8f103568bf63629e90949a95250ca29063
>
> My code moves any footnote containing an image to the top of the page and moves the body down accordingly.
>
> This hack is really bad however. The output "looks" exactly how I want it to at least, but I'll probably go to programmer's hell for this eventually. So, I'd rather like to do it right. Are there any FOP developers here on this mailing list or should I post to the dev list instead?
>
> Michel
>
>
>> On 28 Nov 2016, at 18:27, Frank Hirsch <[hidden email]> wrote:
>>
>> Sorry, I thought there would be a way to use fo:float and of:block. I tried myself and did not succeed.
>>
>> Best,
>> Frank
>>
>>> Am 28.11.2016 um 17:10 schrieb Csaba Nánai <[hidden email]>:
>>>
>>> Hi
>>>
>>> You have right. Só in fop the flow ás its name is nőt paged. It paginating át rendering time. You can using the sequences ás ie ms word but zhese can be more complex. You can also playing with forced page braking before or after a paragraph or block-container table etc.
>>>
>>> Só you have many chamce tó do It bit you cannot put something exactly to a nimbered page becose fop not page oriented.
>>>
>>> Bye szeak
>>>
>>> 2016. nov. 28. 15:44 ezt írta ("Michel Krämer" <[hidden email]>):
>>> Hi Szeak!
>>>
>>> This works! Thank you so much.
>>>
>>> Do I understand it correctly that I need to know in advance on which page my figure appears? So if I need it on page 100 I will have to repeat <fo:single-page-master-reference master-reference="content"/> 99 times?
>>>
>>> I'm asking because I'm generating a rather large document from DocBook using XSLT. There are many figures on different pages and I want to put some of them to the top of their respective page. I guess there is no easy solution for this with FOP, right?
>>>
>>> Michel
>>>
>>>
>>>> On 28 Nov 2016, at 14:04, Szeak (Register Man) <[hidden email]> wrote:
>>>>
>>>> Hi,
>>>>
>>>> My solution for your need is:
>>>>
>>>> <fo:layout-master-set>
>>>>       <fo:simple-page-master master-name="content" page-height="297mm" page-width="210mm" margin="0.2in">
>>>>           <fo:region-body>
>>>>           </fo:region-body>
>>>>       </fo:simple-page-master>
>>>>       <fo:simple-page-master master-name="content-with-header" page-height="297mm" page-width="210mm" margin="0.2in">
>>>>           <fo:region-body margin-top="2.5in"/>
>>>>           <fo:region-before extent="2.5in"/>
>>>>       </fo:simple-page-master>
>>>>
>>>>       <fo:page-sequence-master master-name="mixed-content">
>>>>           <fo:single-page-master-reference master-reference="content"/>
>>>>           <fo:single-page-master-reference master-reference="content-with-header"/>
>>>>           <fo:repeatable-page-master-reference master-reference="content"/>
>>>>       </fo:page-sequence-master>
>>>>   </fo:layout-master-set>
>>>>   <fo:page-sequence master-reference="mixed-content">
>>>>       <fo:static-content flow-name="xsl-region-before">
>>>>           <fo:block font-size="11pt" font-style="italic" font-weight="normal" hyphenate="false" keep-with-previous.within-column="always" line-stacking-strategy="font-height" space-after.maximum="1.7em" space-after.minimum="1.3em" space-after.optimum="1.5em" space-before.maximum="0em" space-before.minimum="0em" space-before.optimum="0em" text-indent="0pt">
>>>>               Figure 3.1 Layers of code in a complex software architecture
>>>>           </fo:block>
>>>>           <fo:block background-color="red" id="img-layers-of-code" keep-together.within-column="always" text-align="center">
>>>>               <fo:block id="d69e465" text-align="center">
>>>>                   <fo:external-graphic content-height="auto" content-width="66%" height="auto" src="url(https://placeholdit.imgix.net/~text?txtsize=33&amp;txt=350%C3%97150&amp;w=350&amp;h=150&amp;fm=png)" width="auto">
>>>>                   </fo:external-graphic>
>>>>               </fo:block>
>>>>               <fo:block font-size="11pt" font-style="italic" font-weight="normal" hyphenate="false" keep-with-previous.within-column="always" line-stacking-strategy="font-height" space-after.maximum="1.7em" space-after.minimum="1.3em" space-after.optimum="1.5em" space-before.maximum="0em" space-before.minimum="0em" space-before.optimum="0em" text-indent="0pt">
>>>>                   Figure 1 Lorem ipsum dolor sit amet
>>>>               </fo:block>
>>>>           </fo:block>
>>>>       </fo:static-content>
>>>>       <fo:flow flow-name="xsl-region-body">
>>>>
>>>> ....  the content of body
>>>>
>>>> Bye
>>>>
>>>> 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) <[hidden email]> 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) <[hidden email]> 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: [hidden email]
>>>>>>>>> For additional commands, e-mail: [hidden email]
>>>>>>>>>
>>>>>>>> ---------------------------------------------------------------------
>>>>>>>> To unsubscribe, e-mail: [hidden email]
>>>>>>>> For additional commands, e-mail: [hidden email]
>>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: [hidden email]
>>>>>>> For additional commands, e-mail: [hidden email]
>>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: [hidden email]
>>>>>> For additional commands, e-mail: [hidden email]
>>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: [hidden email]
>>>>> For additional commands, e-mail: [hidden email]
>>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: [hidden email]
>>>> For additional commands, e-mail: [hidden email]
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [hidden email]
>>> For additional commands, e-mail: [hidden email]
>>>
>>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>

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

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Place image at top of page

Szeak (Register Man)
In reply to this post by Michel Krämer
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) <[hidden email]> 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) <[hidden email]> 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: [hidden email]
>>>>> For additional commands, e-mail: [hidden email]
>>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: [hidden email]
>>>> For additional commands, e-mail: [hidden email]
>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [hidden email]
>>> For additional commands, e-mail: [hidden email]
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>


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

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Place image at top of page

Michel Krämer
In reply to this post by Frank Hirsch
> I once did setup a project based on fop 1.0, I never had a requirement to update…
Thanks, Frank. I think this is what I'm going to do.

Cheers,
Michel

> On 29 Nov 2016, at 09:20, Frank Hirsch <[hidden email]> wrote:
>
> Hi Michael,
>
> If it works for you it might be a valid solution - I once did setup a project based on fop 1.0, I never had a requirement to update... but I am not an expert when it comes down to customization. At least I would not send you to hell ;-)
>
> What I also did to achieve something I was not able to solve in FO (run tables across double page) was to use Area Tree: the FO was built on DIN A3 master pages and the cut into DIN A4 in a post process... But using the hack seems much more plausible to me in your case?
>
> Best,
> Frank
>
>> Am 29.11.2016 um 07:34 schrieb Michel Krämer <[hidden email]>:
>>
>> Frank,
>>
>> Thanks for trying. It didn't work for me either. Here's an example that seems to work in other renderers but not in FOP:
>> http://www.herongyang.com/XSL-FO/Float-Add-xsl-before-float-Separator.html
>>
>> That's why I said earlier I suspect the float-before thing is not fully implemented yet.
>>
>> In the meantime I got it working with a really bad hack:
>> https://github.com/michel-kraemer/fop/commit/be163d8f103568bf63629e90949a95250ca29063
>>
>> My code moves any footnote containing an image to the top of the page and moves the body down accordingly.
>>
>> This hack is really bad however. The output "looks" exactly how I want it to at least, but I'll probably go to programmer's hell for this eventually. So, I'd rather like to do it right. Are there any FOP developers here on this mailing list or should I post to the dev list instead?
>>
>> Michel
>>
>>
>>> On 28 Nov 2016, at 18:27, Frank Hirsch <[hidden email]> wrote:
>>>
>>> Sorry, I thought there would be a way to use fo:float and of:block. I tried myself and did not succeed.
>>>
>>> Best,
>>> Frank
>>>
>>>> Am 28.11.2016 um 17:10 schrieb Csaba Nánai <[hidden email]>:
>>>>
>>>> Hi
>>>>
>>>> You have right. Só in fop the flow ás its name is nőt paged. It paginating át rendering time. You can using the sequences ás ie ms word but zhese can be more complex. You can also playing with forced page braking before or after a paragraph or block-container table etc.
>>>>
>>>> Só you have many chamce tó do It bit you cannot put something exactly to a nimbered page becose fop not page oriented.
>>>>
>>>> Bye szeak
>>>>
>>>> 2016. nov. 28. 15:44 ezt írta ("Michel Krämer" <[hidden email]>):
>>>> Hi Szeak!
>>>>
>>>> This works! Thank you so much.
>>>>
>>>> Do I understand it correctly that I need to know in advance on which page my figure appears? So if I need it on page 100 I will have to repeat <fo:single-page-master-reference master-reference="content"/> 99 times?
>>>>
>>>> I'm asking because I'm generating a rather large document from DocBook using XSLT. There are many figures on different pages and I want to put some of them to the top of their respective page. I guess there is no easy solution for this with FOP, right?
>>>>
>>>> Michel
>>>>
>>>>
>>>>> On 28 Nov 2016, at 14:04, Szeak (Register Man) <[hidden email]> wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>> My solution for your need is:
>>>>>
>>>>> <fo:layout-master-set>
>>>>>      <fo:simple-page-master master-name="content" page-height="297mm" page-width="210mm" margin="0.2in">
>>>>>          <fo:region-body>
>>>>>          </fo:region-body>
>>>>>      </fo:simple-page-master>
>>>>>      <fo:simple-page-master master-name="content-with-header" page-height="297mm" page-width="210mm" margin="0.2in">
>>>>>          <fo:region-body margin-top="2.5in"/>
>>>>>          <fo:region-before extent="2.5in"/>
>>>>>      </fo:simple-page-master>
>>>>>
>>>>>      <fo:page-sequence-master master-name="mixed-content">
>>>>>          <fo:single-page-master-reference master-reference="content"/>
>>>>>          <fo:single-page-master-reference master-reference="content-with-header"/>
>>>>>          <fo:repeatable-page-master-reference master-reference="content"/>
>>>>>      </fo:page-sequence-master>
>>>>>  </fo:layout-master-set>
>>>>>  <fo:page-sequence master-reference="mixed-content">
>>>>>      <fo:static-content flow-name="xsl-region-before">
>>>>>          <fo:block font-size="11pt" font-style="italic" font-weight="normal" hyphenate="false" keep-with-previous.within-column="always" line-stacking-strategy="font-height" space-after.maximum="1.7em" space-after.minimum="1.3em" space-after.optimum="1.5em" space-before.maximum="0em" space-before.minimum="0em" space-before.optimum="0em" text-indent="0pt">
>>>>>              Figure 3.1 Layers of code in a complex software architecture
>>>>>          </fo:block>
>>>>>          <fo:block background-color="red" id="img-layers-of-code" keep-together.within-column="always" text-align="center">
>>>>>              <fo:block id="d69e465" text-align="center">
>>>>>                  <fo:external-graphic content-height="auto" content-width="66%" height="auto" src="url(https://placeholdit.imgix.net/~text?txtsize=33&amp;txt=350%C3%97150&amp;w=350&amp;h=150&amp;fm=png)" width="auto">
>>>>>                  </fo:external-graphic>
>>>>>              </fo:block>
>>>>>              <fo:block font-size="11pt" font-style="italic" font-weight="normal" hyphenate="false" keep-with-previous.within-column="always" line-stacking-strategy="font-height" space-after.maximum="1.7em" space-after.minimum="1.3em" space-after.optimum="1.5em" space-before.maximum="0em" space-before.minimum="0em" space-before.optimum="0em" text-indent="0pt">
>>>>>                  Figure 1 Lorem ipsum dolor sit amet
>>>>>              </fo:block>
>>>>>          </fo:block>
>>>>>      </fo:static-content>
>>>>>      <fo:flow flow-name="xsl-region-body">
>>>>>
>>>>> ....  the content of body
>>>>>
>>>>> Bye
>>>>>
>>>>> 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) <[hidden email]> 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) <[hidden email]> 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: [hidden email]
>>>>>>>>>> For additional commands, e-mail: [hidden email]
>>>>>>>>>>
>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>> To unsubscribe, e-mail: [hidden email]
>>>>>>>>> For additional commands, e-mail: [hidden email]
>>>>>>>>>
>>>>>>>> ---------------------------------------------------------------------
>>>>>>>> To unsubscribe, e-mail: [hidden email]
>>>>>>>> For additional commands, e-mail: [hidden email]
>>>>>>>>
>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: [hidden email]
>>>>>>> For additional commands, e-mail: [hidden email]
>>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: [hidden email]
>>>>>> For additional commands, e-mail: [hidden email]
>>>>>>
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: [hidden email]
>>>>> For additional commands, e-mail: [hidden email]
>>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: [hidden email]
>>>> For additional commands, e-mail: [hidden email]
>>>>
>>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>


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

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Place image at top of page

Andreas Delmelle-2
In reply to this post by Michel Krämer
Hi Michel

Sorry to chime in so late on this...

> On 25 Nov 2016, at 17:11, Michel Krämer <[hidden email]> wrote:
>
> I'm looking for a way to place an image at the top of the page, just like you can do it in LaTeX:
>
> ...
> <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?

Not really, I'm afraid. If the box is absolutely positioned then it will overlap with the other content... :(

>
> 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!

I cannot recall immediately to what extent the feature is implemented at this point, but since start-floats are already implemented, that means there is already a mapping for the fo:float element, so no need to worry about that.

I do recall from past discussions that the "simplest" solution would be to treat before-floats very much in the same way as footnotes, only instead of the eventual layout element list being appended to the 'current' page, the list would be prepended.

So, that would be one important clue: try to focus on getting to understand which flow a footnote follows in the code, and you should have a template to work off of. Ideally, we want to make sure that code that can be shared, is also shared, so do not hesitate to introduce a common superclass for FootnoteLayoutManager and BeforeFloatLayoutManager, or something like that, if that can save some copy-pasting...

Eventually, for the line layout algorithm, it does not yet matter _where_ on the page the float will end up, only that it is out-of-line content that (basically) has no effect on the line breaks, it only needs to be anchored to a line box.
For the page breaking algorithm, same as footnotes, it does not matter _where_ on the page the float should end up, just how much space it will take up, if included.

Only in the last layout phase, when adding the areas to the tree, the paths of before-float and footnote diverge.

Hope the above info helps already. If you start nosing around, and/or have other questions or an idea that you want to bounce back, do subscribe to fop-dev, and follow up there.


Cheers

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

Loading...