/** * A builder class for {@link FopFactory} which can be used for setting configuration. * * @param enviro the profile of the FOP deployment environment */ public FopFactoryBuilder(EnvironmentProfile enviro) { config = new FopFactoryConfigImpl(enviro); fopFactoryConfigBuilder = new ActiveFopFactoryConfigBuilder((FopFactoryConfigImpl) config); }
/** * Builds an instance of the the {@link FopFactory}. * * @return the FopFactory instance */ public FopFactory build() { return FopFactory.newInstance(buildConfiguration()); }
/** * Returns the renderer configuration object for a particular MIME type. * * @param mimeType the config MIME type * @param configCreator the parser for creating the config for the first run of parsing. * @return the renderer configuration object * @throws FOPException if an error occurs when creating the config object */ public RendererConfig getRendererConfig(String mimeType, RendererConfigParser configCreator) throws FOPException { return factory.getRendererConfig(this, getRendererConfiguration(mimeType), configCreator); }
private ContentHandler getFOPContentHandler(OutputStream out) throws FOPException { Fop fop = fopFactory.newFop(this.outputMime, out); return fop.getDefaultHandler(); }
/** * Returns a new {@link Fop} instance. FOP will be configured with a default user agent * instance. * <p> * MIME types are used to select the output format (ex. "application/pdf" for PDF). You can * use the constants defined in {@link MimeConstants}. * @param outputFormat the MIME type of the output format to use (ex. "application/pdf"). * @return the new Fop instance * @throws FOPException when the constructor fails */ public Fop newFop(String outputFormat) throws FOPException { return newFOUserAgent().newFop(outputFormat); }
/** * @see com.isotrol.impe3.palette.pdf.fop.FopService#newUserAgent() */ public FOUserAgent newUserAgent() { return fopFactory.newFOUserAgent(); }
public FopConfParser(InputStream fopConfStream, URI baseURI, EnvironmentProfile enviro) throws SAXException, IOException { DefaultConfigurationBuilder cfgBuilder = new DefaultConfigurationBuilder(); Configuration cfg; try { cfg = cfgBuilder.build(fopConfStream); } catch (ConfigurationException e) { throw new FOPException(e); } // The default base URI is taken from the directory in which the fopConf resides fopFactoryBuilder = new FopFactoryBuilder(enviro).setConfiguration(cfg); configure(baseURI, enviro.getResourceResolver(), cfg); }
/** * Returns a new FopFactory instance that is configured using the {@link FopFactoryConfig} object that * is created when the fopConf is parsed. * * @param fopConf the fop conf configuration file to parse * @return the requested FopFactory instance. * @throws IOException * @throws SAXException */ public static FopFactory newInstance(File fopConf) throws SAXException, IOException { return new FopConfParser(fopConf).getFopFactoryBuilder().build(); }
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!"); } }
/** * Sets the target resolution in dpi. This value defines the target resolution of * bitmap images generated by the bitmap renderers (such as the TIFF renderer) and of * bitmap images generated by filter effects in Apache Batik. * @param dpi resolution in dpi */ public void setTargetResolution(int dpi) { setTargetResolution((float)dpi); }
/** * gets the renderer configuration data for a specific renderer. * * @param mimeType the MIME type * @return the renderer configuration data * @throws FOPException if an error occurs */ protected RendererConfig getRendererConfig(String mimeType) throws FOPException { return userAgent.getRendererConfig(mimeType, rendererConfigParser); }
/** * Gets the default page-width to use as fallback, * in case page-width="auto" * * @return the page-width, as a String * @see FopFactory#getPageWidth() */ public String getPageWidth() { return factory.getPageWidth(); }
/** * Is the user configuration to be validated? * @return if the user configuration should be validated */ public boolean validateUserConfigStrictly() { return factory.validateUserConfigStrictly(); }
/** * Returns a new FOUserAgent instance. Use the FOUserAgent to configure special values that * are particular to a rendering run. Don't reuse instances over multiple rendering runs but * instead create a new one each time and reuse the FopFactory. * @return the newly created FOUserAgent instance initialized with default values */ public FOUserAgent newFOUserAgent() { FOUserAgent userAgent = new FOUserAgent(this, resolver); return userAgent; }
/** * Sets whether to include accessibility features in document creation. * * @param enableAccessibility true to set accessibility on * @return <code>this</code> */ public FopFactoryBuilder setAccessibility(boolean enableAccessibility) { fopFactoryConfigBuilder.setAccessibility(enableAccessibility); return this; }
/** * Sets the base URI, this will be used for resolving all URIs given to FOP. * * @param baseURI the base URI * @return <code>this</code> */ public FopFactoryBuilder setBaseURI(URI baseURI) { fopFactoryConfigBuilder.setBaseURI(baseURI); return this; }
/** * Sets the resolution of resolution-dependent input. * * @param dpi the source resolution * @return <code>this</code> */ public FopFactoryBuilder setSourceResolution(float dpi) { fopFactoryConfigBuilder.setSourceResolution(dpi); return this; }
/** * Get the user configuration. * @return the user configuration */ public Configuration getUserConfig() { return factory.getUserConfig(); }
/** * Returns a new {@link Fop} instance. FOP will be configured with a default user agent * instance. Use this factory method if your output type requires an output stream. * <p> * MIME types are used to select the output format (ex. "application/pdf" for PDF). You can * use the constants defined in {@link MimeConstants}. * @param outputFormat the MIME type of the output format to use (ex. "application/pdf"). * @param stream the output stream * @return the new Fop instance * @throws FOPException when the constructor fails */ public Fop newFop(String outputFormat, OutputStream stream) throws FOPException { return newFOUserAgent().newFop(outputFormat, stream); }
/** * Returns a new FopFactory instance that is configured using the {@link FopFactoryConfig} object that * is created when the fopConf is parsed. * * @param baseURI the base URI to resolve resource URIs against * @param confStream the fop conf configuration stream to parse * @return the requested FopFactory instance. * @throws SAXException * @throws IOException */ public static FopFactory newInstance(URI baseURI, InputStream confStream) throws SAXException, IOException { return new FopConfParser(confStream, baseURI).getFopFactoryBuilder().build(); }