I am using fop 0.90 and am running into into a thorny issue:
It processes and then throws and exception on which I am stuck. Please help.
I am attaching ths stack trace and the fop file(attachment) and the code as well at the bottom:

CODE:

public void convertFO2PDF() throws IOException, FOPException
        {          
            OutputStream out = null;           
            try
            {
                File fo = new File("c:/indata.fo");
                File pdf = new File("c:/indata.pdf");

                System.out.println("HERE NOW");
                // Construct fop with desired output format
                Fop fop = new Fop(MimeConstants.MIME_PDF);
                System.out.println("AFTER HERE NOW");
       
               
                // Setup output stream.  Note: Using BufferedOutputStream
                // for performance reasons (helpful with FileOutputStreams).
                out = new FileOutputStream(pdf);
                out = new BufferedOutputStream(out);
                fop.setOutputStream(out);

                // Setup JAXP using identity transformer
                TransformerFactory factory = TransformerFactory.newInstance();
                Transformer transformer = factory.newTransformer(); // identity transformer
               
                // Setup input stream
                Source src = "" StreamSource(fo);

                // Resulting SAX events (the generated FO) must be piped through to FOP
                Result res = new SAXResult(fop.getDefaultHandler());
               
                // Start XSLT transformation and FOP processing
               
                System.out.println("START TRANSFORMING DATA");               
                transformer.transform(src, res);
                System.out.println("FINISHED TRANSFORMING DATA");
               
                // Result processing
                FormattingResults foResults = fop.getResults();
                java.util.List pageSequences = foResults.getPageSequences();
                for (java.util.Iterator it = pageSequences.iterator(); it.hasNext();) {
                    PageSequenceResults pageSequenceResults = (PageSequenceResults)it.next();
                    System.out.println("PageSequence "
                            + (String.valueOf(pageSequenceResults.getID()).length() > 0
                                    ? pageSequenceResults.getID() : "<no id>")
                            + " generated " + pageSequenceResults.getPageCount() + " pages.");
                }
                System.out.println("Generated " + foResults.getPageCount() + " pages in total.");

            } catch (Exception e)      {         e.printStackTrace(System.out);}           
            finally {
                if(out != null)
                out.close(); }
        }



DEBUG] [PropertyMaker.java:251] [15:59:33,328,PropertyMaker] PropertyMaker.findProperty: white-space-collapse, fo:block
[DEBUG] [PropertyMaker.java:251] [15:59:33,328,PropertyMaker] PropertyMaker.findProperty: widows, fo:block
[DEBUG] [PropertyMaker.java:251] [15:59:33,328,PropertyMaker] PropertyMaker.findProperty: wrap-option, fo:block


java.util.EmptyStackException
    at java.util.Stack.peek(Stack.java:79)
    at org.apache.fop.fo.expr.PropertyInfo.getFunctionPercentBase(PropertyInfo.java:129)
    at org.apache.fop.fo.expr.PropertyInfo.getPercentBase(PropertyInfo.java:62)
    at org.apache.fop.fo.expr.PropertyParser.parsePrimaryExpr(PropertyParser.java:266)
    at org.apache.fop.fo.expr.PropertyParser.parseUnaryExpr(PropertyParser.java:210)
    at org.apache.fop.fo.expr.PropertyParser.parseMultiplicativeExpr(PropertyParser.java:175)
    at org.apache.fop.fo.expr.PropertyParser.parseAdditiveExpr(PropertyParser.java:148)
    at org.apache.fop.fo.expr.PropertyParser.parseProperty(PropertyParser.java:122)
    at org.apache.fop.fo.expr.PropertyParser.parse(PropertyParser.java:88)
    at org.apache.fop.fo.properties.PropertyMaker.make(PropertyMaker.java:421)
    at org.apache.fop.fo.PropertyList.convertAttributeToProperty(PropertyList.java:307)
    at org.apache.fop.fo.PropertyList.addAttributesToList(PropertyList.java:263)
    at org.apache.fop.fo.FObj.processNode(FObj.java:119)
    at org.apache.fop.fo.FOTreeBuilder.startElement(FOTreeBuilder.java:273)
    at org.apache.xalan.transformer.TransformerIdentityImpl.startElement(TransformerIdentityImpl.java:1020)
    at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
    at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
    at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
    at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
    at org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:452)
    at visualmaker.PDFWriter.convertFO2PDF(PDFWriter.java:155)
    at visualmaker.PDFWriter.writePDF2(PDFWriter.java:108)
    at visualmaker.PDFMaker.main(PDFMaker.java:203)
Finished Producing PDF DOC
Done with  pdf writer


Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls. Great rates starting at 1ยข/min.

Attachment: indata.fo
Description: 2366962278-indata.fo

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

Reply via email to