You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Theresa Jayne Forster <th...@inbrand.co.uk> on 2011/09/15 17:10:24 UTC

Conversion from 0.23 to 1.00

I have converted my code from 0.23 to 1.00

 

But I am having problems with my graphics.

 

In the past we have used scale and it has scaled properly, 

Now under 1.00 its not scaling at all (well cropping) 

Am I missing something (the original 0.23 had been modded to provide extras
like cmyk as %, z-index and float)

 

My xsl is creating a fo file but the image is not being cropped, Is there
any way to keep it inside the block-container 

I am getting errors like this 

 

WARNING: Line 1 of a paragraph overflows the available area by 11339
millipoints. (See position 1399:11)

15-Sep-2011 16:01:04 org.apache.fop.events.LoggingEventListener processEvent

WARNING: Content overflows the viewport of an fo:block-container in
block-progression direction by 17123 millipoints. (See position 1398:91)

15-Sep-2011 16:01:04 org.apache.fop.events.LoggingEventListener processEvent

WARNING: Content overflows the viewport of an fo:block-container in
block-progression direction by 5784 millipoints. (See position 1984:91)

15-Sep-2011 16:01:04 org.apache.fop.events.LoggingEventListener processEvent

WARNING: Content overflows the viewport of an fo:block-container in
block-progression direction by 5784 millipoints. (See position 1989:134)

 

 

Kindest regards

 


Theresa Forster

Senior Software Developer



 


Re: Conversion from 0.23 to 1.00

Posted by Pascal Sancho <pa...@takoma.fr>.
Hi Theresa,

one way to crop an image is to carry it within a svg snippet:

<fo:instream-foreign-object width="100%" height="100%"
    content-width="scale-to-fit" content-height="scale-to-fit">
  <svg xmlns="http://www.w3.org/2000/svg"
       xmlns:xlink="http://www.w3.org/1999/xlink"
      width="50mm" height="50mm" viewBox="0 0 100 100">
    <clipPath id="myClip">
      <rect x="0" y="0" width="100" height="100"/>
    </clipPath>
    <g clip-path="url(#myClip)">
      <image x="-5" y="-5" width="130" height="130"
          xlink:href="image_url_here"/>
    </g>
  </svg>
</fo:instream-foreign-object>


Le 16/09/2011 15:12, Theresa Jayne Forster a écrit :
> Eric, looks like you had similar to me,
> But I have a modded version of 0.23 which supports stuff such as z-index
> and floats,
> If someone was interested in deciphering what I have to put into the
> trunk then please contact me as I am not able myself – not enough time.
>                 <xsl:template name="crop-scale-image">
>                                 <xsl:param name="content-width"/>
>                                 <xsl:param name="content-height"/>
>                                 <xsl:param name="imgurl"/>
>                                 <xsl:variable name="imginfourl">
> <xsl:text>http://www.myserver/ImageDataServlet-1.0/ImageDataServlet?imgsrc=</xsl:text>
>                                                 <xsl:value-of
> select="$imgurl"/>
>                                 </xsl:variable>
>                                 <xsl:variable name="imginfo"
> select="document($imginfourl)"/>
>                                 <xsl:variable name="imgWidthmm"
> select="$imginfo/imginfo/imgwidth div 3.779527559"/>
>                                 <xsl:variable name="imgHeightmm"
> select="$imginfo/imginfo/imgheight div 3.779527559"/>
>                                 <xsl:variable name="xscale"
> select="$content-width div $imgWidthmm"/>
>                                 <xsl:variable name="yscale"
> select="$content-height div $imgHeightmm"/>
>                                 <xsl:variable name="scale">
>                                                 <xsl:choose>
> <xsl:when test="$xscale >= $yscale">
> <xsl:value-of select="$xscale"/>
>                                                                 </xsl:when>
> <xsl:otherwise>
> <xsl:value-of select="$yscale"/>
> </xsl:otherwise>
>                                                 </xsl:choose>
>                                 </xsl:variable>
>                                 <xsl:choose>
>                                                 <xsl:when test="$yscale
>> $xscale">
> <fo:external-graphic scaling-method="resample-any-method"
> height="{$content-height}mm"
> width="{$content-width}mm"
> src="{$imgurl}"
> content-x="0mm"
> content-y="0mm"
> content-width="{$imgWidthmm * $scale}mm"
> content-height="{$imgHeightmm * $scale}mm"
> clip="auto"
> movie="auto"
>                                                                 />
>                                                 </xsl:when>
>                                                 <xsl:otherwise >
> <fo:external-graphic scaling-method="resample-any-method"
> height="{$content-height}mm"
> width="{$content-width}mm"
> src="{$imgurl}"
> content-x="0mm"
> content-y="0mm"
> content-width="{$imgWidthmm * $scale}mm"
> content-height="{$imgHeightmm * $scale}mm"
> clip="auto"
> movie="auto"
>                                                                 />
>                                                 </xsl:otherwise>
>                                 </xsl:choose>
>                 </xsl:template>              
> 
> Kindest regards
> Theresa Forster
> Senior Software Developer
> 
> *From:*Eric Douglas [mailto:edouglas@blockhouse.com]
> *Sent:* 16 September 2011 14:05
> *To:* fop-users@xmlgraphics.apache.org
> *Subject:* RE: Conversion from 0.23 to 1.00
> 
>  
> 
> Try some sort of wrapper (tag within a tag)?
> 
> I never got FOP to properly find external images so I'm currently only
> using inline SVG for images but it has size and positioning on multiple
> tag levels (if that helps?).
> 
> <fo:block>
> <xsl:attributename=/"line-height"/>1</xsl:attribute>
> <xsl:attributename=/"font-size"/>0pt</xsl:attribute>
> <fo:instream-foreign-object>
> <xsl:attributename=/"content-width"/><xsl:value-ofselect=/"$BLOCKW"//></xsl:attribute>
> <xsl:attributename=/"content-height"/><xsl:value-ofselect=/"$BLOCKH"//></xsl:attribute>
> <xsl:attributename=/"scaling"/>non-uniform</xsl:attribute>
> <svg:svg>
> <xsl:attributename=/"preserveAspectRatio"/>xMinYMin meet</xsl:attribute>
> <xsl:attributename=/"width"/>100%</xsl:attribute>
> <xsl:attributename=/"height"/>100%</xsl:attribute>
> <xsl:attributename=/"viewBox"/><xsl:value-ofselect=/"concat('0',',','0',',','556',',','84')"//></xsl:attribute>
> 
> ------------------------------------------------------------------------
> 
> *From:*Theresa Jayne Forster [mailto:theresa@inbrand.co.uk]
> <mailto:[mailto:theresa@inbrand.co.uk]>
> *Sent:* Friday, September 16, 2011 3:22 AM
> *To:* fop-users@xmlgraphics.apache.org
> <ma...@xmlgraphics.apache.org>
> *Subject:* RE: Conversion from 0.23 to 1.00
> 
> I found the problem,  whilst 0.23 does not moan when you set the
> content-width=”123mm” apparently in 0.95 and above,
> 
> You have to have it set to “auto-scale” otherwise it will just appear as
> full size….
> 
> Oh well…. Maybe the rescaling will work better – and what if you want to
> crop it?
> 
> Kindest regards
> Theresa Forster
> Senior Software Developer
> 
> *From:*Eric Douglas [mailto:edouglas@blockhouse.com]
> <mailto:[mailto:edouglas@blockhouse.com]>
> *Sent:* 15 September 2011 16:17
> *To:* fop-users@xmlgraphics.apache.org
> <ma...@xmlgraphics.apache.org>
> *Subject:* RE: Conversion from 0.23 to 1.00
> 
> A sample would help.
> Is it an external image? an instream image?
> Are you setting the attributes?
> content-width, content-height, scaling?
> In my image block I also set line-height='1' and font-size='0pt'
> 
> ------------------------------------------------------------------------
> 
> *From:*Theresa Jayne Forster [mailto:theresa@inbrand.co.uk]
> <mailto:[mailto:theresa@inbrand.co.uk]>
> *Sent:* Thursday, September 15, 2011 11:10 AM
> *To:* fop-users@xmlgraphics.apache.org
> <ma...@xmlgraphics.apache.org>
> *Subject:* Conversion from 0.23 to 1.00
> 
> I have converted my code from 0.23 to 1.00
> But I am having problems with my graphics.
> In the past we have used scale and it has scaled properly,
> Now under 1.00 its not scaling at all (well cropping)
> Am I missing something (the original 0.23 had been modded to provide
> extras like cmyk as %, z-index and float)
> My xsl is creating a fo file but the image is not being cropped, Is
> there any way to keep it inside the block-container
> I am getting errors like this
> 
> WARNING: Line 1 of a paragraph overflows the available area by 11339
> millipoints. (See position 1399:11)
> 
> 15-Sep-2011 16:01:04 org.apache.fop.events.LoggingEventListener processEvent
> 
> WARNING: Content overflows the viewport of an fo:block-container in
> block-progression direction by 17123 millipoints. (See position 1398:91)
> 
> 15-Sep-2011 16:01:04 org.apache.fop.events.LoggingEventListener processEvent
> 
> WARNING: Content overflows the viewport of an fo:block-container in
> block-progression direction by 5784 millipoints. (See position 1984:91)
> 
> 15-Sep-2011 16:01:04 org.apache.fop.events.LoggingEventListener processEvent
> 
> WARNING: Content overflows the viewport of an fo:block-container in
> block-progression direction by 5784 millipoints. (See position 1989:134)
> 
> Kindest regards
> Theresa Forster
> Senior Software Developer

-- 
Pascal

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


RE: Conversion from 0.23 to 1.00

Posted by Theresa Jayne Forster <th...@inbrand.co.uk>.
Eric, looks like you had similar to me, 

But I have a modded version of 0.23 which supports stuff such as z-index and
floats, 

If someone was interested in deciphering what I have to put into the trunk
then please contact me as I am not able myself - not enough time.

 

                <xsl:template name="crop-scale-image">

                                <xsl:param name="content-width"/>

                                <xsl:param name="content-height"/>

                                <xsl:param name="imgurl"/>

 

                                <xsl:variable name="imginfourl">

 
<xsl:text>http://www.myserver/ImageDataServlet-1.0/ImageDataServlet?imgsrc=<
/xsl:text>

                                                <xsl:value-of
select="$imgurl"/>

                                </xsl:variable>

                                <xsl:variable name="imginfo"
select="document($imginfourl)"/>

                                <xsl:variable name="imgWidthmm"
select="$imginfo/imginfo/imgwidth div 3.779527559"/>

                                <xsl:variable name="imgHeightmm"
select="$imginfo/imginfo/imgheight div 3.779527559"/>

                                <xsl:variable name="xscale"
select="$content-width div $imgWidthmm"/>

                                <xsl:variable name="yscale"
select="$content-height div $imgHeightmm"/>

                                <xsl:variable name="scale">

                                                <xsl:choose>

                                                                <xsl:when
test="$xscale >= $yscale">

 
<xsl:value-of select="$xscale"/>

                                                                </xsl:when>

 
<xsl:otherwise>

 
<xsl:value-of select="$yscale"/>

 
</xsl:otherwise>

                                                </xsl:choose>

                                </xsl:variable>

                                <xsl:choose>

                                                <xsl:when test="$yscale >
$xscale">

 
<fo:external-graphic scaling-method="resample-any-method"

 
height="{$content-height}mm"

 
width="{$content-width}mm"

 
src="{$imgurl}"

 
content-x="0mm"

 
content-y="0mm"

 
content-width="{$imgWidthmm * $scale}mm"

 
content-height="{$imgHeightmm * $scale}mm"

 
clip="auto"

 
movie="auto"

                                                                />

                                                </xsl:when>

                                                <xsl:otherwise >

 
<fo:external-graphic scaling-method="resample-any-method"

 
height="{$content-height}mm"

 
width="{$content-width}mm"

 
src="{$imgurl}"

 
content-x="0mm"

 
content-y="0mm"

 
content-width="{$imgWidthmm * $scale}mm"

 
content-height="{$imgHeightmm * $scale}mm"

 
clip="auto"

 
movie="auto"

                                                                />

                                                </xsl:otherwise>

                                </xsl:choose>

                </xsl:template>               

 

Kindest regards

 


Theresa Forster

Senior Software Developer



 

From: Eric Douglas [mailto:edouglas@blockhouse.com] 
Sent: 16 September 2011 14:05
To: fop-users@xmlgraphics.apache.org
Subject: RE: Conversion from 0.23 to 1.00

 

Try some sort of wrapper (tag within a tag)?

I never got FOP to properly find external images so I'm currently only using
inline SVG for images but it has size and positioning on multiple tag levels
(if that helps?).

<fo:block>

<xsl:attribute name="line-height">1</xsl:attribute>

<xsl:attribute name="font-size">0pt</xsl:attribute>

<fo:instream-foreign-object>

<xsl:attribute name="content-width"><xsl:value-of
select="$BLOCKW"/></xsl:attribute>

<xsl:attribute name="content-height"><xsl:value-of
select="$BLOCKH"/></xsl:attribute>

<xsl:attribute name="scaling">non-uniform</xsl:attribute>

<svg:svg>

<xsl:attribute name="preserveAspectRatio">xMinYMin meet</xsl:attribute>

<xsl:attribute name="width">100%</xsl:attribute>

<xsl:attribute name="height">100%</xsl:attribute>

<xsl:attribute name="viewBox"><xsl:value-of
select="concat('0',',','0',',','556',',','84')"/></xsl:attribute>

 

  _____  

From: Theresa Jayne Forster [mailto:theresa@inbrand.co.uk] 
Sent: Friday, September 16, 2011 3:22 AM
To: fop-users@xmlgraphics.apache.org
Subject: RE: Conversion from 0.23 to 1.00

I found the problem,  whilst 0.23 does not moan when you set the
content-width="123mm" apparently in 0.95 and above, 

You have to have it set to "auto-scale" otherwise it will just appear as
full size.. 

Oh well.. Maybe the rescaling will work better - and what if you want to
crop it?

 

 

Kindest regards

 


Theresa Forster

Senior Software Developer

From: Eric Douglas [mailto:edouglas@blockhouse.com] 
Sent: 15 September 2011 16:17
To: fop-users@xmlgraphics.apache.org
Subject: RE: Conversion from 0.23 to 1.00

 

A sample would help.

Is it an external image? an instream image?

Are you setting the attributes?

content-width, content-height, scaling?

In my image block I also set line-height='1' and font-size='0pt'

 

 

  _____  

From: Theresa Jayne Forster [mailto:theresa@inbrand.co.uk] 
Sent: Thursday, September 15, 2011 11:10 AM
To: fop-users@xmlgraphics.apache.org
Subject: Conversion from 0.23 to 1.00

I have converted my code from 0.23 to 1.00

 

But I am having problems with my graphics.

 

In the past we have used scale and it has scaled properly, 

Now under 1.00 its not scaling at all (well cropping) 

Am I missing something (the original 0.23 had been modded to provide extras
like cmyk as %, z-index and float)

 

My xsl is creating a fo file but the image is not being cropped, Is there
any way to keep it inside the block-container 

I am getting errors like this 

 

WARNING: Line 1 of a paragraph overflows the available area by 11339
millipoints. (See position 1399:11)

15-Sep-2011 16:01:04 org.apache.fop.events.LoggingEventListener processEvent

WARNING: Content overflows the viewport of an fo:block-container in
block-progression direction by 17123 millipoints. (See position 1398:91)

15-Sep-2011 16:01:04 org.apache.fop.events.LoggingEventListener processEvent

WARNING: Content overflows the viewport of an fo:block-container in
block-progression direction by 5784 millipoints. (See position 1984:91)

15-Sep-2011 16:01:04 org.apache.fop.events.LoggingEventListener processEvent

WARNING: Content overflows the viewport of an fo:block-container in
block-progression direction by 5784 millipoints. (See position 1989:134)

 

 

Kindest regards

 


Theresa Forster

Senior Software Developer

 

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1410 / Virus Database: 1520/3898 - Release Date: 09/15/11

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1410 / Virus Database: 1520/3899 - Release Date: 09/15/11


RE: Conversion from 0.23 to 1.00

Posted by Eric Douglas <ed...@blockhouse.com>.
Try some sort of wrapper (tag within a tag)?
I never got FOP to properly find external images so I'm currently only
using inline SVG for images but it has size and positioning on multiple
tag levels (if that helps?).
<fo:block>

<xsl:attribute name="line-height">1</xsl:attribute>

<xsl:attribute name="font-size">0pt</xsl:attribute>

<fo:instream-foreign-object>

<xsl:attribute name="content-width"><xsl:value-of
select="$BLOCKW"/></xsl:attribute>

<xsl:attribute name="content-height"><xsl:value-of
select="$BLOCKH"/></xsl:attribute>

<xsl:attribute name="scaling">non-uniform</xsl:attribute>

<svg:svg>

<xsl:attribute name="preserveAspectRatio">xMinYMin meet</xsl:attribute>

<xsl:attribute name="width">100%</xsl:attribute>

<xsl:attribute name="height">100%</xsl:attribute>

<xsl:attribute name="viewBox"><xsl:value-of
select="concat('0',',','0',',','556',',','84')"/></xsl:attribute>


________________________________

From: Theresa Jayne Forster [mailto:theresa@inbrand.co.uk] 
Sent: Friday, September 16, 2011 3:22 AM
To: fop-users@xmlgraphics.apache.org
Subject: RE: Conversion from 0.23 to 1.00



I found the problem,  whilst 0.23 does not moan when you set the
content-width="123mm" apparently in 0.95 and above, 

You have to have it set to "auto-scale" otherwise it will just appear as
full size.... 

Oh well.... Maybe the rescaling will work better - and what if you want
to crop it?

 

 

Kindest regards

 


Theresa Forster

Senior Software Developer



From: Eric Douglas [mailto:edouglas@blockhouse.com] 
Sent: 15 September 2011 16:17
To: fop-users@xmlgraphics.apache.org
Subject: RE: Conversion from 0.23 to 1.00

 

A sample would help.

Is it an external image? an instream image?

Are you setting the attributes?

content-width, content-height, scaling?

In my image block I also set line-height='1' and font-size='0pt'

 

 

________________________________

From: Theresa Jayne Forster [mailto:theresa@inbrand.co.uk] 
Sent: Thursday, September 15, 2011 11:10 AM
To: fop-users@xmlgraphics.apache.org
Subject: Conversion from 0.23 to 1.00

I have converted my code from 0.23 to 1.00

 

But I am having problems with my graphics.

 

In the past we have used scale and it has scaled properly, 

Now under 1.00 its not scaling at all (well cropping) 

Am I missing something (the original 0.23 had been modded to provide
extras like cmyk as %, z-index and float)

 

My xsl is creating a fo file but the image is not being cropped, Is
there any way to keep it inside the block-container 

I am getting errors like this 

 

WARNING: Line 1 of a paragraph overflows the available area by 11339
millipoints. (See position 1399:11)

15-Sep-2011 16:01:04 org.apache.fop.events.LoggingEventListener
processEvent

WARNING: Content overflows the viewport of an fo:block-container in
block-progression direction by 17123 millipoints. (See position 1398:91)

15-Sep-2011 16:01:04 org.apache.fop.events.LoggingEventListener
processEvent

WARNING: Content overflows the viewport of an fo:block-container in
block-progression direction by 5784 millipoints. (See position 1984:91)

15-Sep-2011 16:01:04 org.apache.fop.events.LoggingEventListener
processEvent

WARNING: Content overflows the viewport of an fo:block-container in
block-progression direction by 5784 millipoints. (See position 1989:134)

 

 

Kindest regards

 


Theresa Forster

Senior Software Developer

 

________________________________

No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1410 / Virus Database: 1520/3898 - Release Date: 09/15/11


RE: Conversion from 0.23 to 1.00

Posted by Theresa Jayne Forster <th...@inbrand.co.uk>.
I found the problem,  whilst 0.23 does not moan when you set the
content-width="123mm" apparently in 0.95 and above, 

You have to have it set to "auto-scale" otherwise it will just appear as
full size.. 

Oh well.. Maybe the rescaling will work better - and what if you want to
crop it?

 

 

Kindest regards

 


Theresa Forster

Senior Software Developer



From: Eric Douglas [mailto:edouglas@blockhouse.com] 
Sent: 15 September 2011 16:17
To: fop-users@xmlgraphics.apache.org
Subject: RE: Conversion from 0.23 to 1.00

 

A sample would help.

Is it an external image? an instream image?

Are you setting the attributes?

content-width, content-height, scaling?

In my image block I also set line-height='1' and font-size='0pt'

 

 

  _____  

From: Theresa Jayne Forster [mailto:theresa@inbrand.co.uk] 
Sent: Thursday, September 15, 2011 11:10 AM
To: fop-users@xmlgraphics.apache.org
Subject: Conversion from 0.23 to 1.00

I have converted my code from 0.23 to 1.00

 

But I am having problems with my graphics.

 

In the past we have used scale and it has scaled properly, 

Now under 1.00 its not scaling at all (well cropping) 

Am I missing something (the original 0.23 had been modded to provide extras
like cmyk as %, z-index and float)

 

My xsl is creating a fo file but the image is not being cropped, Is there
any way to keep it inside the block-container 

I am getting errors like this 

 

WARNING: Line 1 of a paragraph overflows the available area by 11339
millipoints. (See position 1399:11)

15-Sep-2011 16:01:04 org.apache.fop.events.LoggingEventListener processEvent

WARNING: Content overflows the viewport of an fo:block-container in
block-progression direction by 17123 millipoints. (See position 1398:91)

15-Sep-2011 16:01:04 org.apache.fop.events.LoggingEventListener processEvent

WARNING: Content overflows the viewport of an fo:block-container in
block-progression direction by 5784 millipoints. (See position 1984:91)

15-Sep-2011 16:01:04 org.apache.fop.events.LoggingEventListener processEvent

WARNING: Content overflows the viewport of an fo:block-container in
block-progression direction by 5784 millipoints. (See position 1989:134)

 

 

Kindest regards

 


Theresa Forster

Senior Software Developer

 

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1410 / Virus Database: 1520/3898 - Release Date: 09/15/11


RE: Conversion from 0.23 to 1.00

Posted by Eric Douglas <ed...@blockhouse.com>.
A sample would help.
Is it an external image? an instream image?
Are you setting the attributes?
content-width, content-height, scaling?
In my image block I also set line-height='1' and font-size='0pt'
 

________________________________

From: Theresa Jayne Forster [mailto:theresa@inbrand.co.uk] 
Sent: Thursday, September 15, 2011 11:10 AM
To: fop-users@xmlgraphics.apache.org
Subject: Conversion from 0.23 to 1.00



I have converted my code from 0.23 to 1.00

 

But I am having problems with my graphics.

 

In the past we have used scale and it has scaled properly, 

Now under 1.00 its not scaling at all (well cropping) 

Am I missing something (the original 0.23 had been modded to provide
extras like cmyk as %, z-index and float)

 

My xsl is creating a fo file but the image is not being cropped, Is
there any way to keep it inside the block-container 

I am getting errors like this 

 

WARNING: Line 1 of a paragraph overflows the available area by 11339
millipoints. (See position 1399:11)

15-Sep-2011 16:01:04 org.apache.fop.events.LoggingEventListener
processEvent

WARNING: Content overflows the viewport of an fo:block-container in
block-progression direction by 17123 millipoints. (See position 1398:91)

15-Sep-2011 16:01:04 org.apache.fop.events.LoggingEventListener
processEvent

WARNING: Content overflows the viewport of an fo:block-container in
block-progression direction by 5784 millipoints. (See position 1984:91)

15-Sep-2011 16:01:04 org.apache.fop.events.LoggingEventListener
processEvent

WARNING: Content overflows the viewport of an fo:block-container in
block-progression direction by 5784 millipoints. (See position 1989:134)

 

 

Kindest regards

 


Theresa Forster

Senior Software Developer