You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by "J.U. Anderegg" <ha...@bluewin.ch> on 2002/04/25 10:03:14 UTC

FOP PDF extensions: multilevel outlines, form fields, Javascript

Specification Request

I programmed multilevel outlines, form fields, Javascripts with the PDF
classes of Fop-0.20.1. These experiments, attacking from the back end, lead
to these conclusions:


1. PDF Extensions can be added to the PDF classes on a clean way. The trick
is when/where to insert PDF objects to avoid troubles with reference
resolutions.


2. Extension Types

Definition "position": the page and page coordinates of a rendered element.

2.1 Element text/attributes only

	example: startup JavaScript

		<fox:startupScript file="startup.js"/>

2.2 Element text/attributes + position of parent element

	example: outlines

		<fo:block>This is a heading level 1
		  <fox:outline level="1">Go and see heading level 1</fox:outline>
		</fo:block>

2.3 Element text/attributes + position of parent element + reserved
rectangle coordinates

	example: form fields

		<fo:block>
		  <fox:form file="f9viewer.form" width="30mm" height="10mm"/>
		</fo:block>

		(Implemented with external files, which in turn pull in further exteral
JavaScript files in my implementation).

2.4/5/6 corresponding to 2.1/2/3 but a reference to a subtree in xsl:fo
input instead of just text/attributes of a single element.

	example: fancier form fields in XML

		<fo:block>
		  <fox:formField type="button" width="30mm" height="10mm">
		  	<fox:action>
			  some Javascript
		  	</fox:action>
		      <fox:appearance>
			  some PDF stuff
		      </fox:appearance>
		  <fox:formField
		</fo:block



So FOP has to do depending on the extension type:
- get a position
- format/reserve the reqested page space
- setup arguments
- transfer control into the code of the PDFRenderer with the arguments. The
addressing of methods has to be specified. New methods have to be added, so
that existing methods are not modified. The code has to be executed while
method "renderPage" is working. Lots of things happen in FOP in a different
sequence from the xsl:fo XML sequence.

A few general interfaces enable powerful PDF extensions - in the first
approach perhaps with rather crude input representations like native PDF
syntax. Organization of XML, XSL, other components and procedures are anyway
the key to success. That's what I learnt from development of a multilingual
application.

Next: math and chemical formulas, embedding EPS - you name it?

Hansuli Anderegg



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org