Package org.apache.fop.apps

Examples of org.apache.fop.apps.FOUserAgent


     * @throws IOException In case of an I/O problem
     * @throws FOPException In case of a FOP problem
     */
    public void convertFO2RTF(File fo, File rtf) throws IOException, FOPException {

        FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
        // configure foUserAgent as desired

        OutputStream out = null;

        try {
View Full Code Here


        OutputStream out = null;
        Fop fop;

        try {
            FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
            // configure foUserAgent as desired

            // Setup output stream.  Note: Using BufferedOutputStream
            // for performance reasons (helpful with FileOutputStreams).
            out = new FileOutputStream(pdf);
View Full Code Here

            System.out.println("Transforming...");

            // configure fopFactory as desired
            FopFactory fopFactory = FopFactory.newInstance();

            FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
            // configure foUserAgent as desired

            // Setup output
            OutputStream out = new java.io.FileOutputStream(pdffile);
            out = new java.io.BufferedOutputStream(out);
View Full Code Here

     */
    public void convertToIntermediate(Source src, Source xslt, File intermediate)
                throws IOException, FOPException, TransformerException {

        //Create a user agent
        FOUserAgent userAgent = fopFactory.newFOUserAgent();

        //Create an instance of the target document handler so the IFSerializer
        //can use its font setup
        IFDocumentHandler targetHandler = userAgent.getRendererFactory().createDocumentHandler(
                userAgent, MimeConstants.MIME_PDF);

        //Create the IFSerializer to write the intermediate format
        IFSerializer ifSerializer = new IFSerializer();
        ifSerializer.setContext(new IFContext(userAgent));

        //Tell the IFSerializer to mimic the target format
        ifSerializer.mimicDocumentHandler(targetHandler);

        //Make sure the prepared document handler is used
        userAgent.setDocumentHandlerOverride(ifSerializer);

        // Setup output
        OutputStream out = new java.io.FileOutputStream(intermediate);
        out = new java.io.BufferedOutputStream(out);
        try {
View Full Code Here

        // Setup output
        OutputStream out = new java.io.FileOutputStream(pdffile);
        out = new java.io.BufferedOutputStream(out);
        try {
            //Setup user agent
            FOUserAgent userAgent = fopFactory.newFOUserAgent();

            //Setup target handler
            String mime = MimeConstants.MIME_PDF;
            IFDocumentHandler targetHandler = fopFactory.getRendererFactory().createDocumentHandler(
                    userAgent, mime);
View Full Code Here

    }
   
    public static void convertFo2Pdf(Document fo, OutputStream out) throws FileNotFoundException, FOPException, TransformerConfigurationException, TransformerException {
        // Setup input stream
        try {
            FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
            // Construct fop with desired output format
            Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, out);
           
            // Setup JAXP using identity transformer
            TransformerFactory factory = TransformerFactory.newInstance();
View Full Code Here

    }
   
    public static void convertFo2Pdf(Document fo, OutputStream out) throws FileNotFoundException, FOPException, TransformerConfigurationException, TransformerException {
        // Setup input stream
        try {
            FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
            // Construct fop with desired output format
            Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, out);
           
            // Setup JAXP using identity transformer
            TransformerFactory factory = TransformerFactory.newInstance();
View Full Code Here

    public static Fop createFopInstance(OutputStream out, String outputFormat) throws FOPException {
        if (UtilValidate.isEmpty(outputFormat)) {
            outputFormat = MimeConstants.MIME_PDF;
        }
        FopFactory fopFactory = getFactoryInstance();
        FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
        Fop fop;
        if (out != null) {
            fop = fopFactory.newFop(outputFormat, foUserAgent, out);
        } else {
            fop = fopFactory.newFop(outputFormat, foUserAgent);
View Full Code Here

    public static void startFOP(String[] args) {
        //System.out.println("static CCL: "
        //    + Thread.currentThread().getContextClassLoader().toString());
        //System.out.println("static CL: " + Fop.class.getClassLoader().toString());
        CommandLineOptions options = null;
        FOUserAgent foUserAgent = null;
        OutputStream out = null;

        try {
            options = new CommandLineOptions();
            options.parse(args);
           
            foUserAgent = options.getFOUserAgent();
            String outputFormat = options.getOutputFormat();

            try {
                if (options.getOutputFile() != null) {
                    out = new java.io.BufferedOutputStream(
                            new java.io.FileOutputStream(options.getOutputFile()));
                    foUserAgent.setOutputFile(options.getOutputFile());
                }
                if (!MimeConstants.MIME_XSL_FO.equals(outputFormat)) {
                    options.getInputHandler().renderTo(foUserAgent, outputFormat, out);
                } else {
                    options.getInputHandler().transformTo(out);
View Full Code Here

            task.log(foFile + " -> " + outFile, Project.MSG_INFO);
        }

        boolean success = false;
        try {
            FOUserAgent userAgent = fopFactory.newFOUserAgent();
            userAgent.setBaseURL(this.baseURL);
            inputHandler.renderTo(userAgent, outputFormat, out);
            success = true;
        } catch (Exception ex) {
            throw new BuildException(ex);
        } finally {
View Full Code Here

TOP

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

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.