Package org.apache.fop.apps

Examples of org.apache.fop.apps.FOPException


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


    /**
     * checks whether all necessary information has been given in a consistent way
     */
    private void checkSettings() throws FOPException, FileNotFoundException {
        if (inputmode == NOT_SET) {
            throw new FOPException("No input file specified");
        }

        if (outputmode == null) {
            throw new FOPException("No output file specified");
        }

        if ((outputmode.equals(MimeConstants.MIME_FOP_AWT_PREVIEW)
                || outputmode.equals(MimeConstants.MIME_FOP_PRINT))
                    && outfile != null) {
            throw new FOPException("Output file may not be specified "
                    + "for AWT or PRINT output");
        }

        if (inputmode == XSLT_INPUT) {
            // check whether xml *and* xslt file have been set
            if (xmlfile == null) {
                throw new FOPException("XML file must be specified for the transform mode");
            }
            if (xsltfile == null) {
                throw new FOPException("XSLT file must be specified for the transform mode");
            }

            // warning if fofile has been set in xslt mode
            if (fofile != null) {
                log.warn("Can't use fo file with transform mode! Ignoring.\n"
                                       + "Your input is " + "\n xmlfile: "
                                       + xmlfile.getAbsolutePath()
                                       + "\nxsltfile: "
                                       + xsltfile.getAbsolutePath()
                                       + "\n  fofile: "
                                       + fofile.getAbsolutePath());
            }
            if (!xmlfile.exists()) {
                throw new FileNotFoundException("Error: xml file "
                                                + xmlfile.getAbsolutePath()
                                                + " not found ");
            }
            if (!xsltfile.exists()) {
                throw new FileNotFoundException("Error: xsl file "
                                                + xsltfile.getAbsolutePath()
                                                + " not found ");
            }

        } else if (inputmode == FO_INPUT) {
            if (outputmode.equals(MimeConstants.MIME_XSL_FO)) {
                throw new FOPException(
                        "FO output mode is only available if you use -xml and -xsl");
            }
            if (xmlfile != null || xsltfile != null) {
                log.warn("fo input mode, but xmlfile or xslt file are set:");
                log.error("xml file: " + xmlfile.toString());
                log.error("xslt file: " + xsltfile.toString());
            }
            if (!fofile.exists()) {
                throw new FileNotFoundException("Error: fo file "
                                                + fofile.getAbsolutePath()
                                                + " not found ");
            }
        } else if (inputmode == AREATREE_INPUT) {
            if (outputmode.equals(MimeConstants.MIME_XSL_FO)) {
                throw new FOPException(
                        "FO output mode is only available if you use -xml and -xsl");
            } else if (outputmode.equals(MimeConstants.MIME_FOP_AREA_TREE)) {
                throw new FOPException(
                        "Area Tree Output is not available if Area Tree is used as input!");
            }
            if (xmlfile != null || xsltfile != null) {
                log.warn("area tree input mode, but xmlfile or xslt file are set:");
                log.error("xml file: " + xmlfile.toString());
View Full Code Here

      // create new span area with multiple columns; return first column area
      return addSpanArea(columnCount);
    }
    else
    {
      throw new FOPException("BodyAreaContainer::getNextArea(): Span attribute messed up");
    }
  }
View Full Code Here

            return;
        }
        try {
            factory.setUserConfig(userConfigFile);
        } catch (SAXException e) {
            throw new FOPException(e);
        }
     }
View Full Code Here

     * @return the chosen output format (MIME type)
     * @throws FOPException for invalid output formats
     */
    protected String getOutputFormat() throws FOPException {
        if (outputmode == null) {
            throw new FOPException("Renderer has not been set!");
        }
        if (outputmode.equals(MimeConstants.MIME_FOP_AREA_TREE)) {
            renderingOptions.put("fineDetail", isCoarseAreaXml());
        }
        return outputmode;
View Full Code Here

    public Status layout(Area area) throws FOPException {
  int numChildren = this.children.size();

  if (numChildren != 1) {
      throw new FOPException("list-item-label must have exactly one block in this version of FOP");
  }
       
        // initialize id                      
        String id = this.properties.get("id").getString();           
        area.getIDReferences().initializeID(id,area);                       
View Full Code Here

                                throws FOPException {
        String name = attlist.getValue("name");
        if (name != null && name.length() > 0) {
            setupCode.setName(name);
        } else {
            throw new FOPException(elementName + " must have a name attribute.");
        }
        if (AFPElementMapping.INCLUDE_PAGE_SEGMENT.equals(elementName)) {
            name = attlist.getValue("src");
            if (name != null && name.length() > 0) {
                setupCode.setValue(name);
            } else {
                throw new FOPException(elementName + " must have a src attribute.");
            }
        } else if (AFPElementMapping.TAG_LOGICAL_ELEMENT.equals(elementName)) {
            name = attlist.getValue("value");
            if (name != null && name.length() > 0) {
                setupCode.setValue(name);
            } else {
                throw new FOPException(elementName + " must have a value attribute.");
            }
        }
    }
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

            if ("quality".equalsIgnoreCase(rendering)) {
                pclRenderer.setQualityBeforeSpeed(true);
            } else if ("speed".equalsIgnoreCase(rendering)) {
                pclRenderer.setQualityBeforeSpeed(false);
            } else if (rendering != null) {
                throw new FOPException(
                        "Valid values for 'rendering' are 'quality' and 'speed'. Value found: "
                            + rendering);
            }
            String textRendering = cfg.getChild("text-rendering").getValue(null);
            if ("bitmap".equalsIgnoreCase(textRendering)) {
                pclRenderer.setAllTextAsBitmaps(true);
            } else if ("auto".equalsIgnoreCase(textRendering)) {
                pclRenderer.setAllTextAsBitmaps(false);
            } else if (textRendering != null) {
                throw new FOPException(
                        "Valid values for 'text-rendering' are 'auto' and 'bitmap'. Value found: "
                            + textRendering);
            }
        }
    }
View Full Code Here

                    LogUtil.handleException(log, e, strict);
                    continue;
                }
                if (directory == null) {
                    LogUtil.handleException(log,
                            new FOPException("directory defined without value"), strict);
                    continue;
                }
                FontFileFinder fontFileFinder = new FontFileFinder(recursive ? -1 : 1);
                try {
                    addFontInfoListFromFileList(
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.