Hi, Andreas,

I'll respond below:

----- Original Message ----- 
From: "Andreas L Delmelle" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Saturday, December 10, 2005 1:37 PM
Subject: Re: 0.90alpha1: content-width="scale-to-fit" creates damaged PDF -
workaround found


> On Dec 10, 2005, at 00:34, [EMAIL PROTECTED] wrote:
>
> Hi Jay,
>
> > After reading the spec, I thought of trying to make the image a fixed
> > width, so I tried
> >
> > <fo:external-graphic src="someimage.gif" content-width="5.5in"/>
> >
> > That makes images less than 5.5 inches wide be 5.5 inches wide,
>
> Errm... Now you're losing me. I thought you were trying to avoid
> smaller images being scaled up (?) A fixed value for content-width
> per se implies scaling if the image is smaller/larger...

At that point, I was just testing in general rather than continuing to chase
what I needed. So I was trying to force both images that are smaller than
the content area and images that are larger than the content area to fit the
content area. Then I was trying to get both smaller and larger images to be
a particular size (5.5in). What I found is that I can specify the width in
pixels but not inches and that scale-to-fit does not work for images larger
than the content area. Sorry about the confusion.

>
> > but the PDF file created by FOP still blows up when it encounters
> > images larger
> > than 5.5 inches wide.
>
> Have you tried adding width="..." to the fo:external-graphic? Works
> fine for me.

Yup. Tried that. It didn't work with images wider than the content area (at
least not with inches as the unit of measure). It DID make images smaller
than the content area fill more of the content area (again with units of
measure = inches).

>
> I must say that it is weird that specifying the width seems to be
> mandatory ATM. If width is absent (= implicit value of 'auto'), then
> for an fo:external-graphic it should become the content-width of the
> graphic, but currently it makes FOP crash in case the image is larger
> than the specified content-width...
>
> Writing
>
> <fo:external-graphic src="image.gif" width="5.5in" content-
> width="5.5in" />
>
> should come down to the same as what you have above.
>
> Even stranger is that I also checked
>
> <fo:external-graphic src="..." width="auto" content-width="5.5in" />
>
> and that worked nicely.
>
> So currently there is a difference between an explicit or an implicit
> auto-width...
>
> > Then I tried it with content-width="396px", and that worked. Yay!
>
> ... except when the content-width is specified in pixels.
>
> > I still think there's a bug in there somewhere, but at least there's a
> > workaround.
>
> Yup, definitely a bug somewhere. As for a workaround, again, I was
> under the impression that you needed images smaller than 5.5in to
> remain as wide as they intrinsically are, but only need scaling down
> for larger graphics... Have I misinterpreted something?

My solution entails reading the width of the graphic (in pixels) through a
Java extension to the XSL processor (Saxon). Then, if the image is less than
396 pixels wide, I just put it in (with <fo:external-graphic
src="someimage.gif"/>. Else, if the image is more than 396 pixels wide, I
force its width to be 396 pixels (with <fo:external-graphic
src="someimage.gif" content-width="396px"/>). So, I'm trying to force the
width only in the case where the graphic exceeds the available space. It was
faster to write an extension function (took 15 minutes or so) than to try to
scale all my screen captures.

Thanks for looking into things.

>
> Cheers,
>
> Andreas

Jay Bryant
Bryant Communication Services



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to