Re: AW: [xep-support] page height/width according to image size

From: W. Eliot Kimber <ekimber@innodata-isogen.com>
Date: Wed Dec 01 2004 - 11:15:12 PST

Wagner, Paul, VF-DE wrote:

> I would like to make my PDFs in this way (I don't know how big or small my image is before!):
>
> <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
> <fo:layout-master-set>
> <fo:simple-page-master master-name="autopage" page-height="auto" page-width="auto">
> // But I don't want get A4-Page-Format here!!!!!
> <fo:region-body region-name="body"/>

There's no way to do this in FO--the page and page region dimensions
must be explicitly specified.

However, you can use a Java XSLT extension to examine your images to get
their intrinsic size and then generate the appropriate page dimensions.
We use the Sun-provided JAI (Java Advanced Imaging) library to do this.

The basic technique is:

import javax.media.jai.JAI;
import javax.media.jai.RenderedOp;

RenderedOp img = JAI.create("fileload", fileName);
// fileName is graphic filename, naturally
height = String.valueOf(img.getHeight());
width = String.valueOf(img.getWidth());

Cheers,

Eliot

-- 
W. Eliot Kimber
Professional Services
Innodata Isogen
9390 Research Blvd, #410
Austin, TX 78759
(512) 372-8122
eliot@innodata-isogen.com
www.innodata-isogen.com
-------------------
(*) To unsubscribe, send a message with words 'unsubscribe xep-support'
in the body of the message to majordomo@renderx.com from the address
you are subscribed from.
(*) By using the Service, you expressly agree to these Terms of Service http://www.renderx.com/tos.html
Received on Wed Dec 1 11:58:30 2004

This archive was generated by hypermail 2.1.8 : Wed Dec 01 2004 - 11:58:32 PST