Inputs
o BMP, GIF, TIF, JPG, FPX, PNM
o SVG instream and external file

Output
o JPEG (Acrobat Reader interprets the complete image file within a PDF file
= no transformation = no lossy info loss)

Features
o colors: RGB, Gray, CMYK
o svg, image processing isolated in renderer XObject class
o little memory requirements
o process and store images and external SVG once in PDF - redisplay them in
various sizes many times
o parameter passing to the rrenderer

XSL:FO interface
By svg <desc> in order to parametrize PDF generation. If FOP let
instream-foreign-objects be foreign without touching them, outlines, form
fields, JavaScripts can be implemented by meaningful XML allowing
unrestricted, safe extension contributions.

The challenge
o Handling layout size of images and svg's.
o Java Advanced Imaging transforms images at load time, properties of the
orignal image are distorted. Programming against the codec's might solve
this problem.
o Given correct properties: how to generate the precise PDF dictionary
entries. For JPEG not too difficult, but other formats?

Software
o JRE 1.3
o Java Advanced Imaging 1.1


Hansuli Anderegg
<?xml version="1.0" encoding="utf-8"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"; xmlns:svg="http://www.w3.org/2000/svg";>

<fo:layout-master-set>
<fo:simple-page-master master-name="seiten" page-height="29.7cm" page-width="21cm" margin-top="2cm" margin-bottom="2cm" margin-left="1.8cm" margin-right="2.0cm">
<fo:region-before region-name="s2ff-before" extent="2.0cm" />
<fo:region-body margin-top="1.0cm" margin-bottom="2.0cm" />
<fo:region-after region-name="s2ff-after" extent="2.0cm" />
</fo:simple-page-master>
</fo:layout-master-set>

<fo:page-sequence master-name="seiten" initial-page-number="1">
<fo:flow flow-name="xsl-region-body">
<fo:block font-size="18pt" font-weight="bold">1. FOP image test</fo:block>
<fo:block width="0pt" height="0pt">
	<fo:instream-foreign-object>
<!--
type: startup
p00: debug
p01: svg_trace
-->
text: startup Javascript
	<svg:svg width="0" height="0">
		<svg:desc> startup,yes,no
			<svg:desc>&lt;&lt; /S /JavaScript /JS (app.beep(0)
this.zoom = 200;) &gt;&gt;
			</svg:desc>
		</svg:desc>
  	</svg:svg>
	</fo:instream-foreign-object>
</fo:block>

<fo:block font-size="16pt" font-weight="bold" space-before.minimum="1em" space-before.optimum="1.5em" space-before.maximum="2em">
A JPEG image in FOP</fo:block>
  <fo:block>
    <fo:instream-foreign-object width="100pt" height="60pt">
	<svg:svg width="0" height="0">
		<svg:desc>img,c:/HU/alt/Fop-0.20.1/docs/graphics/fop.jpg,1.0,fromImage</svg:desc>
 	</svg:svg>
    </fo:instream-foreign-object>
  </fo:block>

<fo:block font-size="16pt" font-weight="bold" space-before.minimum="1em" space-before.optimum="1.5em" space-before.maximum="2em">
JPEG size changed</fo:block>

  <fo:block>
    <fo:instream-foreign-object width="36pt" height="36pt">
	<svg:svg width="0" height="0">
		<svg:desc>img,c:/HU/alt/Fop-0.20.1/docs/graphics/fop.jpg,.80,fromImage</svg:desc>
 	</svg:svg>
    </fo:instream-foreign-object>
  </fo:block>

<fo:block font-size="16pt" font-weight="bold" space-before.minimum="1em" space-before.optimum="1.5em" space-before.maximum="2em">
A PNG image in FOP</fo:block>

  <fo:block>
    <fo:instream-foreign-object width="252pt" height="93pt">
	<svg:svg width="0" height="0">
		<svg:desc>img,c:/HU/alt/Fop-0.20.1/docs/graphics/boat.png,.80,fromImage</svg:desc>
 	</svg:svg>
    </fo:instream-foreign-object>
  </fo:block>

<fo:block font-size="16pt" font-weight="bold" space-before.minimum="1em" space-before.optimum="1.5em" space-before.maximum="2em">
an other png</fo:block>

  <fo:block>
    <fo:instream-foreign-object width="100pt" height="100pt">
	<svg:svg width="0" height="0">
		<svg:desc>img,c:/HU/alt/Fop-0.20.1/docs/graphics/BorderCommonStyle.png,.80,fromImage</svg:desc>
 	</svg:svg>
    </fo:instream-foreign-object>
  </fo:block>

<fo:block break-before="page" font-size="16pt" font-weight="bold" space-before.minimum="1em" space-before.optimum="1.5em" space-before.maximum="2em">
SVG</fo:block>
<fo:block space-after.optimum="15pt" >
 <fo:instream-foreign-object  width="200pt" height="50pt">
 <svg:svg width="200" height="50">
 <svg:g style="fill:red; stroke:#000000">
  <svg:rect x="0" y="0" width="15" height="15" />
  <svg:rect x="5" y="5" width="15" height="15" />
  </svg:g>
  <svg:text x="10" y="30" font-family="sans-serif" font-size="12">SVG placed in a block</svg:text>
  </svg:svg>
  </fo:instream-foreign-object>
</fo:block>

<fo:block font-size="16pt" font-weight="bold" space-before.minimum="1em" space-before.optimum="1.5em" space-before.maximum="2em">
SVG size changed</fo:block>
<fo:block space-after.optimum="15pt">
 <fo:instream-foreign-object width="100pt" height="25pt">
 <svg:svg width="200" height="50">
 <svg:g style="fill:red; stroke:#000000">
  <svg:rect x="0" y="0" width="15" height="15" />
  <svg:rect x="5" y="5" width="15" height="15" />
  </svg:g>
  <svg:text x="10" y="30" font-family="sans-serif" font-size="12">SVG placed in a block</svg:text>
  </svg:svg>
  </fo:instream-foreign-object>
</fo:block>

  <fo:block break-before="page" font-size="16pt" font-weight="bold" space-before.minimum="1em" space-before.optimum="1.5em" space-before.maximum="2em">
SVG external</fo:block>
  <fo:block>
    <fo:instream-foreign-object width="200pt" height="50pt" >
	<svg:svg width="0" height="0">
		<svg:desc>svg,c:/HU/alt/Fop-0.20.1/docs/graphics/boxes.svg,1.0</svg:desc>
 	</svg:svg>
    </fo:instream-foreign-object>
  </fo:block>
  <fo:block font-size="16pt" font-weight="bold" space-before.minimum="1em" space-before.optimum="1.5em" space-before.maximum="2em">
SVG external size changed</fo:block>
  <fo:block>
    <fo:instream-foreign-object width="100pt" height="200pt" >
	<svg:svg width="0" height="0">
		<svg:desc>svg,c:/HU/alt/Fop-0.20.1/docs/graphics/boxes.svg,1.0</svg:desc>
 	</svg:svg>
    </fo:instream-foreign-object>
  </fo:block>

  <fo:block  break-before="page" font-size="16pt" font-weight="bold" space-before.minimum="1em" space-before.optimum="1.5em" space-before.maximum="2em">
BMP image</fo:block>
  <fo:block>
    <fo:instream-foreign-object width="70pt" height="62pt">
	<svg:svg width="0" height="0">
		<svg:desc>img,c:/HU/alt/Fop-0.20.1/docs/graphics/linux.bmp,.80,fromImage</svg:desc>
 	</svg:svg>
    </fo:instream-foreign-object>
  </fo:block>
  <fo:block font-size="16pt" font-weight="bold" space-before.minimum="1em" space-before.optimum="1.5em" space-before.maximum="2em">
BMP reused, size changed</fo:block>
  <fo:block>
    <fo:instream-foreign-object width="36pt" height="36pt">
	<svg:svg width="0" height="0">
		<svg:desc>img,c:/HU/alt/Fop-0.20.1/docs/graphics/linux.bmp,.80,fromImage</svg:desc>
 	</svg:svg>
    </fo:instream-foreign-object>
  </fo:block>

  <fo:block break-before="page" font-size="16pt" font-weight="bold" space-before.minimum="1em" space-before.optimum="1.5em" space-before.maximum="2em">
TIFF image</fo:block>
  <fo:block>
    <fo:instream-foreign-object width="110pt" height="118pt">
	<svg:svg width="0" height="0">
		<svg:desc>img,c:/HU/alt/Fop-0.20.1/docs/graphics/dario.tif,.80,fromImage</svg:desc>
 	</svg:svg>
    </fo:instream-foreign-object>
  </fo:block>
  <fo:block font-size="16pt" font-weight="bold" space-before.minimum="1em" space-before.optimum="1.5em" space-before.maximum="2em">
TIFF reused, size changed</fo:block>
  <fo:block>
    <fo:instream-foreign-object width="36pt" height="70pt">
	<svg:svg width="0" height="0">
		<svg:desc>img,c:/HU/alt/Fop-0.20.1/docs/graphics/dario.tif,.80,fromImage</svg:desc>
 	</svg:svg>
    </fo:instream-foreign-object>
  </fo:block>

  <fo:block  break-before="page" font-size="16pt" font-weight="bold" space-before.minimum="1em" space-before.optimum="1.5em" space-before.maximum="2em">

GIF</fo:block>
  <fo:block>
    <fo:instream-foreign-object width="40.9pt" height="53.0pt">
	<svg:svg width="0" height="0">
		<svg:desc>img,c:/HU/alt/Fop-0.20.1/docs/graphics/page.gif,.80,fromImage</svg:desc>
 	</svg:svg>
    </fo:instream-foreign-object>
  </fo:block>

  <fo:block font-size="16pt" font-weight="bold" space-before.minimum="1em" space-before.optimum="1.5em" space-before.maximum="2em">
GIF  reused, size changed</fo:block>
  <fo:block>
    <fo:instream-foreign-object width="36pt" height="36pt">
	<svg:svg width="0" height="0">
		<svg:desc>img,c:/HU/alt/Fop-0.20.1/docs/graphics/page.gif,.80,fromImage</svg:desc>
 	</svg:svg>
    </fo:instream-foreign-object>
  </fo:block>

  <fo:block  break-before="page" font-size="16pt" font-weight="bold" space-before.minimum="1em" space-before.optimum="1.5em" space-before.maximum="2em">
JPEG big</fo:block>
  <fo:block>
    <fo:instream-foreign-object width="300pt" height="300pt">
	<svg:svg width="0" height="0">
		<svg:desc>img,c:/HU/alt/Fop-0.20.1/docs/graphics/muehle.jpg,.80,fromImage</svg:desc>
 	</svg:svg>
    </fo:instream-foreign-object>
  </fo:block>

<fo:block break-before="page" font-size="16pt" font-weight="bold" space-before.minimum="1em" space-before.optimum="1.5em" space-before.maximum="2em">
the same in gray 256</fo:block>
  <fo:block>
    <fo:instream-foreign-object width="100pt" height="60pt">
	<svg:svg width="0" height="0">
		<svg:desc>img,c:/HU/alt/Fop-0.20.1/docs/graphics/fop_gray.jpg,1.0,fromImage</svg:desc>
 	</svg:svg>
    </fo:instream-foreign-object>
  </fo:block>

  <fo:block  break-before="page" font-size="16pt" font-weight="bold" space-before.minimum="1em" space-before.optimum="1.5em" space-before.maximum="2em">
Test color rgb</fo:block>
  <fo:block>
    <fo:instream-foreign-object width="213pt" height="124pt">
	<svg:svg width="0" height="0">
		<svg:desc>img,c:/HU/alt/Fop-0.20.1/docs/graphics/RGB.jpg,1.0,/DeviceRGB</svg:desc>
 	</svg:svg>
    </fo:instream-foreign-object>
  </fo:block>
  <fo:block  font-size="16pt" font-weight="bold" space-before.minimum="1em" space-before.optimum="1.5em" space-before.maximum="2em">
Test color cmyk</fo:block>
  <fo:block>
    <fo:instream-foreign-object width="213pt" height="124pt">
	<svg:svg width="0" height="0">
		<svg:desc>img,c:/HU/alt/Fop-0.20.1/docs/graphics/CMYK.jpg,1.0,/DeviceCMYK /Decode [1.0 0.0 1.0 0.0 1.0 0.0 1.0 0.0]</svg:desc>
 	</svg:svg>
    </fo:instream-foreign-object>
  </fo:block>
<!--
  <fo:block  font-size="16pt" font-weight="bold" space-before.minimum="1em" space-before.optimum="1.5em" space-before.maximum="2em">
Test color lab</fo:block>
  <fo:block>
    <fo:instream-foreign-object width="213pt" height="124pt">
	<svg:svg width="0" height="0">
		<svg:desc>img,c:/HU/alt/Fop-0.20.1/docs/graphics/lab.tif,1.0,/Lab &#x0020;&lt;&lt;/WhitePoint [0.9505 1.0000 1.0890]&gt;&gt;</svg:desc>
 	</svg:svg>
    </fo:instream-foreign-object>
  </fo:block>
-->
  <fo:block  break-before="page" font-size="16pt" font-weight="bold" space-before.minimum="1em" space-before.optimum="1.5em" space-before.maximum="2em">
GIF transparent image: not supported by JPEG, color indexed</fo:block>
  <fo:block>
    <fo:instream-foreign-object width="221pt" height="96pt">
	<svg:svg width="0" height="0">
		<svg:desc>img,c:/HU/alt/Fop-0.20.1/docs/graphics/xml_feather_transparent.gif,.80,/DeviceCMYK</svg:desc>
 	</svg:svg>
    </fo:instream-foreign-object>
  </fo:block>

<fo:block id="N2559">
  <fo:block font-size="16pt" font-weight="bold" space-before.minimum="1em" space-before.optimum="1.5em" space-before.maximum="2em"/>
  This section is only required to show that the layout still works.
</fo:block>
-->
</fo:flow>
</fo:page-sequence>

</fo:root>
	  

Attachment: PDFXObject.java
Description: Binary data

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

Reply via email to