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 Dridi Seifeddine <sd...@iptech-group.com> on 2014/06/16 16:01:38 UTC

[PDF Renderer] Why FOP scales down 300 dpi images and not maintain the intrinsic image dimension?

Hello,

 

I see a strange issue when I render a 300 dpi image in PDF. The image is
always scaled down.

 

I understand that FOP uses mpt for its internal calculations, and the
formula for pixels to mpt conversion depends on the horizontal/vertical dpi
specified in the image (valueMpt = valuePx * 1000 * 72 / dpi). Thus, the
higher the dpi value, the lower the image size in mpt unit.

 

When I specify the image's width and height, and set attributes
content-width="scale-to-fit" content-height="scale-to-fit", FOP does no
scaling.

 

Thanks

 

Seifeddine

 

 

 


Re: [PDF Renderer] Why FOP scales down 300 dpi images and not maintain the intrinsic image dimension?

Posted by Vincent Hennebert <vh...@gmail.com>.
Hi Seifeddine,

On 16/06/14 16:01, Dridi Seifeddine wrote:
> Hello,
>
>
>
> I see a strange issue when I render a 300 dpi image in PDF. The image is
> always scaled down.
>
>
>
> I understand that FOP uses mpt for its internal calculations, and the
> formula for pixels to mpt conversion depends on the horizontal/vertical dpi
> specified in the image (valueMpt = valuePx * 1000 * 72 / dpi). Thus, the
> higher the dpi value, the lower the image size in mpt unit.
>
>
>
> When I specify the image's width and height, and set attributes
> content-width="scale-to-fit" content-height="scale-to-fit", FOP does no
> scaling.

The image looks fine in the PDF file you attached. Having left
width/height and content-width/height unspecified, the image is left to
its default size which is approximately 16.3x10.8cm.

If you want to scale the image up so that it fills the width of the
page, then you have to set content-width to scale-to-fit /and/ width to,
e.g., 100%:
     <fo:external-graphic src="300dpi.jpg"
       content-width="scale-to-fit" width="100%"/>

If you leave width unspecified then the image will remain at its default
size.

Is that what you were trying to achieve?

>
>
>
> Thanks
>
>
>
> Seifeddine

HTH,
Vincent

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