A couple of new functions to FOP's PDF rendering:

o SVG's and images as page fore-/backgrounds with transparency control
o SVG rendering as image
o Image resolution control by the user
o Caching on the PDF way: store/write a resource once - reuse it
o Open Actions

These add-ons are programmed as instream-foreign-object's by FOP extensions
and by adding code to the PDF renderer. They are outside of XSL-FO standards
and fully compatible with the present FOP.

Tested with: FOP 0.20.4, Java 1.4 and 1.3.1, Batik 1.5

Download: http://mypage.bluewin.ch/huanderegg

Hansuli Anderegg

======================================================

o General structure of instream-foreign-object's

     <fo:instream-foreign-object>
         <anyext:anyext>
                <anyext:extension_element .....
         </anyext:anyext>
    </fo:instream-foreign-object>

(FOP seems to require "<anyext:anyext>"-elements. Who knows why?)

======================================================

FOREGROUNDS AND BACKGROUNDS

o Specifying an SVG resource

 <anyext:svg_resource name="name" src="url" height="points"
        imageResolution="dpi" PDFfonts="yes"/>

- name: to reference a resource
- url:  of an (external) SVG or image file
- height: controls the presentation size of the resource. The viewbox of the
SVG is transformed to the given height with a proportionally sized width.
- points: all measurement are in points = inch/72
- imageResolution="dpi": if present, a JPEG image is created with the asked
resolution
- PDFfonts="yes": if present, PDF fonts are used - otherwise text is drawn
by graphics
_________________________________________________________________

o Specifying a JPEG image resource

 <anyext:image_resource name="<name>" src="<url>"
     widthPix="pixels" heightPix="pixels" width="points" height="points"/>

- widthPix, heightPix: image size in pixels
_________________________________________________________________

o Specifying page foregrounds, backgrounds

 <anyext:form
first="nameReference,pointsX,pointsY,"background"|"foreground",transparency"

odd="nameReference,pointsX,pointsY,"background"|"foreground",transparency"

even="nameReference,pointsX,pointsY,"background"|"foreground",transparency
/>

- first, odd, even: use resource specified by nameReference for first, odd
or even document pages
- "background" or "foreground": resource is to be presented either in
background or foreground layer
- pointsX,pointsY: top/left corner page coordinates of background/foreground
- transparency: constant alpha with defined values "0.25" or "0.5" or "0.75"
or "1.0" (alpha blending simulates the opacity of celluloid layers: 1.0
indicates an opaque pixel, 0.0 indicates a transparent pixel )
_________________________________________________________________

o Resetting page foregrounds and backgrounds by setting nameReference to
"null"

 <anyext:form
first="null,pointsX,pointsY,"background"|"foreground",transparency"
    odd="null,pointsX,pointsY,"background"|"foreground",transparency"
    even="null,pointsX,pointsY,"background"|"foreground",transparency />

_________________________________________________________________

o Rendering an SVG as image

    <fo:instream-foreign-object height="<points>">
        <anyext:anyext><anyext:svg_put src="<url>"
imageResolution="dpi"/></anyext:anyext>
    </fo:instream-foreign-object>

- height: required, so that FOP allocates the space
- imageResolution: resolution control
--> current position(x,y) calculated by FOP formatting

======================================================

VARIOUS EXTENSIONS

o Specifying a startup AcroScript

 <anyext:anyext><anyext:openaction>app.beep(0); this.zoom =
200;</anyext:openaction></anyext:anyext>

Enter any suitable AcroScript statements to set startup options,
preferences, menues etc. in the tag text,
_________________________________________________________________

o Turning on debugging messages

 <anyext:anyext><anyext:debug/></anyext:anyext>

_________________________________________________________________

o and who programs?

 <anyext:bookmark level="n">bookmark text</<anyext:bookmark>

 <anyext:bar3of9 position="50,100" rotation="270" height="24" modwidth="12"
ration="2.5" asterisk="yes" checksum="yes" text="below">
        barcode data</anyext:bar3of9>

================================================================

SAMPLE INPUT

<fo:flow flow-name="xsl-region-body">

<fo:block>
    <fo:instream-foreign-object>
    <anyext:anyext><anyext:debug/></anyext:anyext>
    </fo:instream-foreign-object>

    <fo:instream-foreign-object>
    <anyext:anyext><anyext:openaction>app.beep(0); this.zoom =
200;</anyext:openaction></anyext:anyext>
    </fo:instream-foreign-object>

    <fo:instream-foreign-object>
    <anyext:anyext><anyext:svg_resource name="svg01"
src="file:///C:/fop-0.20.4rc/AnyExtensions/batik01.svg"
    height="80" imageResolution="96"/></anyext:anyext>
    </fo:instream-foreign-object>
    <fo:instream-foreign-object>
    <anyext:anyext><anyext:svg_resource name="svg02"
src="file:///C:/fop-0.20.4rc/AnyExtensions/batik02.svg"
    height="250"/></anyext:anyext>
    </fo:instream-foreign-object>
    <fo:instream-foreign-object>
    <anyext:anyext><anyext:svg_resource name="svg03"
src="file:///C:/fop-0.20.4rc/AnyExtensions/block120.svg"
    height="50" PDFfonts="yes"/></anyext:anyext>
    </fo:instream-foreign-object>

    <fo:instream-foreign-object>
    <anyext:anyext><anyext:image_resource name="img01"
src="file:///C:/fop-0.20.4rc/AnyExtensions/CENTRALIMAGE.JPG"
    widthPix="251" heightPix="375" width="251"
height="375"/></anyext:anyext>
    </fo:instream-foreign-object>

    <fo:instream-foreign-object>
    <anyext:anyext><anyext:form
    first="svg01,50,420,background,0.5"
    odd="svg02,50,420,backround,0.5"
    even="img01,144,216,background,0.5" /></anyext:anyext>
    </fo:instream-foreign-object>
</fo:block>


======================================================



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

Reply via email to