OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [docbook-apps] Included images too big in fop PDF output


On date Wednesday 2007-07-18 13:33:20 -0400, Ken Morse wrote:
> Hi Stefano,
>
> See also 
> http://www.oasis-open.org/archives/docbook-apps/200704/msg00150.html
>
> I've had this problem myself and have resolved it for screen shots by
> not setting any size information in the DocBook source, but rather by
> setting the resolution on the image files. For XEP, I've found setting
> the resolution on each image file (using your favorite graphics
> program or utility) to 120dpi seems to work pretty well. You might
> need to use a slightly different setting (72 or 96dpi) for FOP.
>
> HTH,

Yes, it helped, thanks Ken!

Follows my analysis and solution for the archive.

The problem seems to be that the J-peg images I'm using don't have
exif tags or other information to get their intrinsecs size, and
fop seems to assume as default resolution 72dpi (that is: 2.83/mm),
while my screen has an effective resolution of about 96 dpi (3.77/mm).

Applying that resolution to the J-peg files with a width in picture of
about the half of my screen (1280 / 2 = 640) I get:

W_screen = W_pix  / screen_resolution = 
         = 640    / 3.77 mm ~= 170 mm

which is contained in an A4 paper (210x297 mm).

Fop computes the intrinsic width of the image applying the default
resolution of 72dpi, resulting in:

W_fop = W_pix / assumed_image_resolution =
      = 640   / 2.83 ~= 227 mm

which overflows the A4 paper width size of 210 mm.

As you suggested there are two possible solutions:

1) set in the image file itself the resolution of the image (I'm not
sure this is possible with every image format, but it is with J-peg
ones where you can set the exif tags).

If you want the rendered intrinsic size of the image to be equal to
that of the image viewed on the screen, you have to set the resolution
of the image to that of the screen. In my case I measured an
X-resolution of 1280 / (320 mm) = 4 / mm and an Y-resolution of 800 /
(210 mm) = 3.81/mm, corresponding approximately to 96 dpi (3.77/mm).

I tried to set it with exif but with no success:
 exif --set-value="x-Resolution=96dpi" idct.jpg 
'idct.jpg' does not contain EXIF data!

2) set in the XML source the viewport area, in my case I want the
width not to overflow the width of an A4 paper (210 mm), so I can
safely set for the content area a width of 160 mm.

<equation>
  <title>Inverse discrete cosine transforms (IDCT)</title>
  <mediaobject>
    <imageobject role = "html" >
      <imagedata fileref="equations/idct.jpg" />
    </imageobject>

    <imageobject role = "fo" >
      <imagedata fileref="equations/idct.jpg"
                 contentwidth="160mm" scalefit="1" />
    </imageobject>
  </mediaobject>
</equation>

The ideal would be to be able to set the size relatively to the
maximum viewport size available, to get the rendered image fits the
available space on the page without overflowing the boundaries, while
the relative dimensions setted with contentwidth, width, contentdepth,
etc (for example with contentwidth="66%") seem to be relative to the
computed intrinsic size.

Is it possible to achieve this with docbook?

Cheers
-- 
Stefano Sabatini
Linux user number 337176 (see http://counter.li.org)


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]