AW: [xep-support] page height/width according to image size
W. Eliot Kimber
ekimber at innodata-isogen.com
Wed Dec 1 11:15:12 PST 2004
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 at 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 at 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
More information about the Xep-support
mailing list