Package org.apache.fop.apps

Examples of org.apache.fop.apps.FOPException


    private Vector bfranges = null;

    private void createFont(String path) throws FOPException {
        XMLReader parser = ConfigurationReader.createParser();
        if (parser == null)
            throw new FOPException("Unable to create SAX parser");

        try {
            parser.setFeature("http://xml.org/sax/features/namespace-prefixes",
                              false);
        } catch (SAXException e) {
            throw new FOPException("You need a SAX parser which supports SAX version 2",
                                   e);
        }

        parser.setContentHandler(this);

        try {
            parser.parse(path);
        } catch (SAXException e) {
            throw new FOPException(e);
        } catch (IOException e) {
            throw new FOPException(e);
        }

    }
View Full Code Here


     */
    public Status layout(Area area) throws FOPException {

        if (!(area instanceof ForeignObjectArea)) {
            // this is an error
            throw new FOPException("SVG not in fo:instream-foreign-object");
        }

        if (this.marker == START) {
            this.fs = area.getFontState();

View Full Code Here

                transformer = factory.newTransformer(stylesheet);
            }
            transformer.setURIResolver(new LocalResolver(transformer.getURIResolver()));
            transformer.transform(src, res);
        } catch (Exception e) {
            throw new FOPException(e);
        }
    }
View Full Code Here

          return prop;
        }
        else {
    // throw some kind of exception!
    throw new FOPException("Can't convert value to Length type");
        }
    }
View Full Code Here

        // setting the parser features
        try {
            parser.setFeature("http://xml.org/sax/features/namespace-prefixes",
                              false);
        } catch (SAXException e) {
            throw new FOPException("You need a parser which supports SAX version 2",
                                   e);
        }
        ConfigurationParser configurationParser = new ConfigurationParser();
        parser.setContentHandler(configurationParser);

        try {
            parser.parse(filename);
        } catch (SAXException e) {
            if (e.getException() instanceof FOPException) {
                throw (FOPException)e.getException();
            } else {
                throw new FOPException(e);
            }
        } catch (IOException e) {
            throw new FOPException(e);
        }
    }
View Full Code Here

        }

        try {
            return (XMLReader)Class.forName(parserClassName).newInstance();
        } catch (ClassNotFoundException e) {
            throw new FOPException("Could not find " + parserClassName, e);
        } catch (InstantiationException e) {
            throw new FOPException("Could not instantiate "
                                   + parserClassName, e);
        } catch (IllegalAccessException e) {
            throw new FOPException("Could not access " + parserClassName, e);
        } catch (ClassCastException e) {
            throw new FOPException(parserClassName + " is not a SAX driver",
                                   e);
        }
    }
View Full Code Here

     * @exception FOPException
     */
    public void createID(String id) throws FOPException {
        if (id != null &&!id.equals("")) {
            if (doesIDExist(id)) {
                throw new FOPException("The id \"" + id
                                       + "\" already exists in this document");
            } else {
                createNewId(id);
                removeFromIdValidationList(id);
            }
View Full Code Here

        try {
            page.setExtensions(rootExtensions);
            rootExtensions = null;
            streamRenderer.queuePage(page);
        } catch (IOException e) {
            throw new FOPException(e);
        }
    }
View Full Code Here

            } else if (args[i].equals("-q") || args[i].equals("--quiet")) {
                quiet = new Boolean(true);
            } else if (args[i].equals("-c")) {
                if ((i + 1 == args.length)
                        || (args[i + 1].charAt(0) == '-')) {
                    throw new FOPException("if you use '-c', you must specify the name of the configuration file");
                } else {
                    userConfigFile = new File(args[i + 1]);
                    i++;
                }
            } else if (args[i].equals("-l")) {
                if ((i + 1 == args.length)
                        || (args[i + 1].charAt(0) == '-')) {
                    throw new FOPException("if you use '-l', you must specify a language");
                } else {
                    language = args[i + 1];
                    i++;
                }
            } else if (args[i].equals("-s")) {
                suppressLowLevelAreas = new Boolean(true);
            } else if (args[i].equals("-fo")) {
                inputmode = FO_INPUT;
                if ((i + 1 == args.length)
                        || (args[i + 1].charAt(0) == '-')) {
                    throw new FOPException("you must specify the fo file for the '-fo' option");
                } else {
                    fofile = new File(args[i + 1]);
                    i++;
                }
            } else if (args[i].equals("-xsl")) {
                inputmode = XSLT_INPUT;
                if ((i + 1 == args.length)
                        || (args[i + 1].charAt(0) == '-')) {
                    throw new FOPException("you must specify the stylesheet file for the '-xsl' option");
                } else {
                    xsltfile = new File(args[i + 1]);
                    i++;
                }
            } else if (args[i].equals("-xml")) {
                inputmode = XSLT_INPUT;
                if ((i + 1 == args.length)
                        || (args[i + 1].charAt(0) == '-')) {
                    throw new FOPException("you must specify the input file for the '-xml' option");
                } else {
                    xmlfile = new File(args[i + 1]);
                    i++;
                }
            } else if (args[i].equals("-awt")) {
                setOutputMode(AWT_OUTPUT);
            } else if (args[i].equals("-pdf")) {
                setOutputMode(PDF_OUTPUT);
                if ((i + 1 == args.length)
                        || (args[i + 1].charAt(0) == '-')) {
                    throw new FOPException("you must specify the pdf output file");
                } else {
                    outfile = new File(args[i + 1]);
                    i++;
                }
            } else if (args[i].equals("-mif")) {
                setOutputMode(MIF_OUTPUT);
                if ((i + 1 == args.length)
                        || (args[i + 1].charAt(0) == '-')) {
                    throw new FOPException("you must specify the mif output file");
                } else {
                    outfile = new File(args[i + 1]);
                    i++;
                }
            } else if (args[i].equals("-print")) {
                setOutputMode(PRINT_OUTPUT);
                // show print help
                if (i + 1 < args.length) {
                    if (args[i + 1].equals("help")) {
                        printUsagePrintOutput();
                        return false;
                    }
                }
            } else if (args[i].equals("-pcl")) {
                setOutputMode(PCL_OUTPUT);
                if ((i + 1 == args.length)
                        || (args[i + 1].charAt(0) == '-')) {
                    throw new FOPException("you must specify the pdf output file");
                } else {
                    outfile = new File(args[i + 1]);
                    i++;
                }
            } else if (args[i].equals("-ps")) {
                setOutputMode(PS_OUTPUT);
                if ((i + 1 == args.length)
                        || (args[i + 1].charAt(0) == '-')) {
                    throw new FOPException("you must specify the PostScript output file");
                } else {
                    outfile = new File(args[i + 1]);
                    i++;
                }
            } else if (args[i].equals("-txt")) {
                setOutputMode(TXT_OUTPUT);
                if ((i + 1 == args.length)
                        || (args[i + 1].charAt(0) == '-')) {
                    throw new FOPException("you must specify the text output file");
                } else {
                    outfile = new File(args[i + 1]);
                    i++;
                }
            } else if (args[i].charAt(0) != '-') {
                if (inputmode == NOT_SET) {
                    inputmode = FO_INPUT;
                    fofile = new File(args[i]);
                } else if (outputmode == NOT_SET) {
                    outputmode = PDF_OUTPUT;
                    outfile = new File(args[i]);
                } else {
                    throw new FOPException("Don't know what to do with "
                                           + args[i]);
                }
            } else if (args[i].equals("-buf")) {
                if (buffermode == NOT_SET) {
                    buffermode = BUFFER_FILE;
                } else {
                    MessageHandler.errorln("ERROR: you can only set one buffer method");
                    printUsage();
                }
                if ((i + 1 == args.length)
                        || (args[i + 1].charAt(0) == '-')) {
                    MessageHandler.errorln("ERROR: you must specify the buffer output file");
                    printUsage();
                } else {
                    bufferFile = new File(args[i + 1]);
                    i++;
                }
            } else if (args[i].equals("-at")) {
                setOutputMode(AREA_OUTPUT);
                if ((i + 1 == args.length)
                        || (args[i + 1].charAt(0) == '-')) {
                    throw new FOPException("you must specify the area-tree output file");
                } else {
                    outfile = new File(args[i + 1]);
                    i++;
                }
            } else {
View Full Code Here

    private void setOutputMode(int mode) throws FOPException {
        if (outputmode == NOT_SET) {
            outputmode = mode;
        } else {
            throw new FOPException("you can only set one output method");
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.fop.apps.FOPException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.