The ways to use the fot2pdf formatter
=====================================

1.
Supply a fot-file (generated by Jade, an XSL processor or by hand), which 
is actually a well-formed, error-free XML file. The filename is given as 
the primary argument to the class "com.pdftech.fot2pdf.app" which reads 
the fot2pdf file and generates the PDF file from it. Parameters to the 
backend are given through command line arguments (see documentation).
Example:

java com.pdftech.fot2pdf.app infile.fot -o outfile.pdf -D fot2pdfbasedir



2.
Use of a SAX-compliant parser or application to feed the XML file to 
the backend directely. This one uses the same basic class as above, 
yet the given filename is read and parsed through an XML parser (or 
something acting like one) before processed by the formatter. The class 
name of the SAX-parser is given via the "-s" command line option.
Example:

java com.pdftech.fot2pdf.app -s com.jclark.xml.sax.Driver infile.xml -o outfile.pdf -D fot2pdfbasedir



3.
Special applications can interface directly and feed the fotfile via 
standard SAX events into the formatter. This requires two steps:

- Setting any required parameters in the documented classes
  com.pdftech.fot2pdf.parameters
  com.pdftech.fot2pdf.pdf.PDFparameters
  com.pdftech.fot2pdf.formatter.FormatterParameters

- instantiating the event handler for the SAX events (which 
  implements the DefaultHandler/ContentHandler of SAX2):

  import com.pdftech.fot2pdf.xml.saxhandler;
  saxhandler fotreader = new saxhandler();

- Running the application which creates the fot and passes it to the 
  formatter:
  
  EventProducingApp producer = new EventProcducingApp(fotreader);
  producer.run();
  
- Initiate PDF generation by calling the formatter:

  import com.pdftech.fot2pdf.formatter.Formatter;
  Formatter pdfmaker = new Formatter(fotreader,outfname);
  pdfmaker.run();


4.
Same as (3), but running multithreaded: The formatter itself can be run at 
the same time the producer creates the flow object tree; this might reduce 
memory requirements and wasted machine cycles during i/o. The code for this 
is:

  import com.pdftech.fot2pdf.xml.saxhandler;
  import com.pdftech.fot2pdf.formatter.Formatter;

  saxhandler fotreader = new saxhandler();

  ThreadGroup g = new ThreadGroup("pdfgen");

  EventProducingApp producer = new EventProcducingApp(g,fotreader);
  producer.start();

  Formatter pdfmaker = new Formatter(g,fotreader,outfname);
  pdfmaker.start();

  while (g.activeCount()!=0);



That's it.




C. Drescher, 2000-06-05
drescher@pro-image.de

