xmlgraphics-fop-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fernando López Carballeda <ferna...@lopez.org>
Subject First step.
Date Tue, 05 Dec 2000 21:15:14 GMT
Hi,

I'm a beginner in FOP and I download the fop-0_15_0-forBeginners.zip file.
Now I'm trying to build my first PDF. But I obtain severals warnings and
errors:

file to render: fop/docs/examples/fo/images.fo

I'm interesting in know why I have "WARNING: Unknown formatting object"


using renderer org.apache.fop.render.pdf.PDFRenderer
using element mapping org.apache.fop.fo.StandardElementMapping
using element mapping org.apache.fop.svg.SVGElementMapping
building formatting object tree
WARNING: Unknown value for text-align: center
WARNING: Unknown formatting object
http://www.w3.org/1999/XSL/Format^page-sequence-master
WARNING: Unknown formatting object
http://www.w3.org/1999/XSL/Format^repeatable-page-master-alternatives
WARNING: Unknown formatting object
http://www.w3.org/1999/XSL/Format^conditional-page-master-reference
WARNING: this version of FOP only supports static-content in region-before
and region-after
WARNING: Unknown value for text-align-last: center
WARNING: Unknown formatting object
http://www.w3.org/1999/XSL/Format^external-graphic
WARNING: this version of FOP only supports static-content in region-before
and region-after
WARNING: Unknown value for text-align-last: center
setting up fonts
formatting FOs into areas
Error en la generación del xml:fo :

org.apache.fop.apps.FOPException: page-sequence is missing an
sequence-specification
org.apache.fop.apps.FOPException: page-sequence is missing an
sequence-specification
	java.lang.Throwable(java.lang.String)
	java.lang.Exception(java.lang.String)
	org.apache.fop.apps.FOPException(java.lang.String)
	org.apache.fop.layout.Page
org.apache.fop.fo.pagination.PageSequence.makePage(org.apache.fop.layout.Are
aTree)
	void
org.apache.fop.fo.pagination.PageSequence.format(org.apache.fop.layout.AreaT
ree)
	void
org.apache.fop.fo.pagination.Root.format(org.apache.fop.layout.AreaTree)
	void org.apache.fop.fo.FOTreeBuilder.format(org.apache.fop.layout.AreaTree)
	void org.apache.fop.apps.Driver.format()
	void Main.FOPXMLDocument(oracle.xml.parser.v2.XMLDocument, java.io.Writer)
	void Main.main(java.lang.String [])

I use the next code(Main.java):

import oracle.xml.parser.v2.XMLDocument;
import oracle.xml.parser.v2.DOMParser;

import java.net.URL;

import java.io.Writer;
import java.io.FileWriter;
import java.io.PrintWriter;

import org.apache.fop.apps.Version;
import org.apache.fop.apps.Driver;

import org.xml.sax.Parser;

class Main {
/**
 * Comentario de constructor Main.
 */
public Main() {
	super();
}
/**
 * Este método lee un fichero XML del sistema de ficheros y lo carga como un
Documento DOM.
 * En caso de problemas envia la excepción al llamante.
 * Fecha de creación: (04/12/2000 19:58:42)
 * @return oracle.xml.parser.v2.XMLDocument
 * @param archivo java.lang.String
 * @exception java.lang.Exception Cualquier excepción generada.
 */
static XMLDocument DocumentFromFile(String archivo) throws Exception {

	try {
		DOMParser domParser = new DOMParser();
		domParser.setPreserveWhitespace(true);

		XMLDocument xml;

		URL xmlURL = new URL("file", null, archivo);

		domParser.parse(xmlURL);
		return domParser.getDocument();
	} catch (Exception e) {
		throw( e);
	}
}
/**
 * ------------- I copy this code from cocoon
 *
 * Este método realiza la renderización de un documento DOM a un fichero PDF
 * pero escribe la salida en un Writer.
 * En caso de problemas envia la excepción al llamante.
 * Fecha de creación: (04/12/2000 20:40:43)
 * @param archivo java.lang.String
 * @exception java.lang.Exception Cualquier excepción generada.
 */
static void FOPXMLDocument(XMLDocument xml, Writer writer) throws Exception
{
	/*
	 * Datos del parseador SAX de conversión xml:fo a PDF.
	 */
	String parserClassName = "org.apache.xerces.parsers.SAXParser";

	try {
		String version = Version.getVersion();

	    Parser saxParser = (Parser)
Class.forName(parserClassName).newInstance();

		Driver driver = new Driver();
		driver.setRenderer("org.apache.fop.render.pdf.PDFRenderer", version);
		driver.addElementMapping("org.apache.fop.fo.StandardElementMapping");
		driver.addElementMapping("org.apache.fop.svg.SVGElementMapping");
		//
driver.addPropertyList("org.apache.fop.fo.StandardPropertyListMapping");
	    // driver.addPropertyList("org.apache.fop.svg.SVGPropertyListMapping");
		driver.setWriter(new PrintWriter(writer));
		driver.buildFOTree(xml);
		driver.format();
		driver.render();
	} catch (Exception e) {
		throw( e);
	}
}
/**
 * Prueba que carga un documento FO desde disco y lo formatea a PDF.
 * @param args una matriz de argumentos de línea de mandatos
 */
public static void main(String[] args) {

	String fileDoc = "fop/docs/examples/fo/images.fo";
	String filePDF = "test.pdf";

	try {
		System.out.println( "Cargo el documento XML a transformar.");
		// Cargo el documento XML a transformar.
		XMLDocument xml = DocumentFromFile( fileDoc);

		FileWriter outFile = new FileWriter(filePDF);

		FOPXMLDocument(xml,outFile);

		outFile.close();

	} catch (Exception e) {
		System.out.println("Error en la generación del xml:fo
:\n\r"+e.toString());
		e.printStackTrace( System.out);

		System.exit(1);
	}

	System.exit (0);
}
}

Thanks in advance,
Fernando López Carballeda


Mime
View raw message