private void setInputFormat(int format) throws FOPException { if (inputmode == NOT_SET || inputmode == format) { inputmode = format; } else { throw new FOPException("Only one input mode can be specified!"); } }
private int parseConfigurationOption(String[] args, int i) throws FOPException { if ((i + 1 == args.length) || (isOption(args[i + 1]))) { throw new FOPException("if you use '-c', you must specify " + "the name of the configuration file"); } else { userConfigFile = new File(args[i + 1]); return 1; } }
private int parseResolution(String[] args, int i) throws FOPException { if ((i + 1 == args.length) || (isOption(args[i + 1]))) { throw new FOPException( "if you use '-dpi', you must specify a resolution (dots per inch)"); } else { this.targetResolution = Integer.parseInt(args[i + 1]); this.overrideTargetResolution = true; return 1; } }
private int parseCopiesOption(String[] args, int i) throws FOPException { if ((i + 1 == args.length) || (isOption(args[i + 1]))) { throw new FOPException("you must specify the number of copies"); } else { renderingOptions.put(PrintRenderer.COPIES, Integer.valueOf(args[i + 1])); return 1; } }
/** * Convenience method that handles any error appropriately * @param log log * @param errorStr error string * @param strict validate strictly * @throws FOPException fop exception */ public static void handleError(Log log, String errorStr, boolean strict) throws FOPException { handleException(log, new FOPException(errorStr), strict); }
/** {@inheritDoc}} */ public AFPFontConfig parse(Configuration cfg, FontManager fontManager, boolean strict, EventProducer eventProducer) throws FOPException { try { return new ParserHelper(cfg, fontManager, strict, (AFPEventProducer) eventProducer).fontConfig; } catch (ConfigurationException ce) { throw new FOPException(ce); } }
public void delete() throws FOPException { if (!getCacheFile(true).delete()) { throw new FOPException("Failed to flush the font cache file '" + cacheFile + "'."); } }
private int parseLanguageOption(String[] args, int i) throws FOPException { if ((i + 1 == args.length) || (isOption(args[i + 1]))) { throw new FOPException("if you use '-l', you must specify a language"); } else { Locale.setDefault(new Locale(args[i + 1], "")); return 1; } }
private PDFEncryptionParams getPDFEncryptionParams() throws FOPException { PDFEncryptionParams params = (PDFEncryptionParams) renderingOptions.get(PDFEncryptionOption.ENCRYPTION_PARAMS); if (params == null) { if (!PDFEncryptionManager.checkAvailableAlgorithms()) { throw new FOPException("PDF encryption requested but it is not available." + " Please make sure MD5 and RC4 algorithms are available."); } params = new PDFEncryptionParams(); renderingOptions.put(PDFEncryptionOption.ENCRYPTION_PARAMS, params); } return params; }
/** {@inheritDoc} */ public void processNode(String elementName, Locator locator, Attributes attlist, PropertyList propertyList) throws FOPException { getExtensionAttachment(); String attr = attlist.getValue("name"); if (attr != null && attr.length() > 0) { extensionAttachment.setName(attr); } else { throw new FOPException(elementName + " must have a name attribute."); } }
private int parseXSLInputOption(String[] args, int i) throws FOPException { setInputFormat(XSLT_INPUT); if ((i + 1 == args.length) || (isOption(args[i + 1]))) { throw new FOPException("you must specify the stylesheet " + "file for the '-xsl' option"); } else { xsltfile = new File(args[i + 1]); return 1; } }
private int parseTextOutputOption(String[] args, int i) throws FOPException { setOutputMode(MimeConstants.MIME_PLAIN_TEXT); if ((i + 1 == args.length) || (isOption(args[i + 1]))) { throw new FOPException("you must specify the text output file"); } else { setOutputFile(args[i + 1]); return 1; } }
private int parseAFPOutputOption(String[] args, int i) throws FOPException { setOutputMode(MimeConstants.MIME_AFP); if ((i + 1 == args.length) || (isOption(args[i + 1]))) { throw new FOPException("you must specify the AFP output file"); } else { setOutputFile(args[i + 1]); return 1; } }
private int parseRTFOutputOption(String[] args, int i) throws FOPException { setOutputMode(MimeConstants.MIME_RTF); if ((i + 1 == args.length) || (isOption(args[i + 1]))) { throw new FOPException("you must specify the RTF output file"); } else { setOutputFile(args[i + 1]); return 1; } }
private int parsePNGOutputOption(String[] args, int i) throws FOPException { setOutputMode(MimeConstants.MIME_PNG); if ((i + 1 == args.length) || (isOption(args[i + 1]))) { throw new FOPException("you must specify the PNG output file"); } else { setOutputFile(args[i + 1]); return 1; } }
private int parsePCLOutputOption(String[] args, int i) throws FOPException { setOutputMode(MimeConstants.MIME_PCL); if ((i + 1 == args.length) || (isOption(args[i + 1]))) { throw new FOPException("you must specify the PDF output file"); } else { setOutputFile(args[i + 1]); return 1; } }
private int parseSVGOutputOption(String[] args, int i) throws FOPException { setOutputMode(MimeConstants.MIME_SVG); if ((i + 1 == args.length) || (isOption(args[i + 1]))) { throw new FOPException("you must specify the SVG output file"); } else { setOutputFile(args[i + 1]); return 1; } }
private int parseFOOutputOption(String[] args, int i) throws FOPException { setOutputMode(MimeConstants.MIME_XSL_FO); if ((i + 1 == args.length) || (isOption(args[i + 1]))) { throw new FOPException("you must specify the FO output file"); } else { setOutputFile(args[i + 1]); return 1; } }
private int parseMIFOutputOption(String[] args, int i) throws FOPException { setOutputMode(MimeConstants.MIME_MIF); if ((i + 1 == args.length) || (isOption(args[i + 1]))) { throw new FOPException("you must specify the MIF output file"); } else { setOutputFile(args[i + 1]); return 1; } }
private int parseTIFFOutputOption(String[] args, int i) throws FOPException { setOutputMode(MimeConstants.MIME_TIFF); if ((i + 1 == args.length) || (isOption(args[i + 1]))) { throw new FOPException("you must specify the TIFF output file"); } else { setOutputFile(args[i + 1]); return 1; } }