Examples of FopFactory


Examples of org.apache.fop.apps.FopFactory

        if (fontResolver == null) {
            //Ensure that we have minimal font resolution capabilities
            fontResolver = FontSetup.createMinimalFontResolver();
        }

        FopFactory factory = userAgent.getFactory();
        boolean strict = factory.validateUserConfigStrictly();
        FontCache fontCache = factory.getFontCache();

        List fontInfoList = buildFontListFromConfiguration(cfg,
                userAgent.getFontBaseURL(), fontResolver, strict,
                fontCache);
       
View Full Code Here

Examples of org.apache.fop.apps.FopFactory

            Document testDoc = builder.parse(testFile);
           
            XObject xo = XPathAPI.eval(testDoc, "/testcase/cfg/base14kerning");
            String s = xo.str();
            boolean base14kerning = ("true".equalsIgnoreCase(s));
            FopFactory effFactory = (base14kerning ? fopFactoryWithBase14Kerning : fopFactory);
           
            //Setup Transformer to convert the testcase XML to XSL-FO
            Transformer transformer = getTestcase2FOStylesheet().newTransformer();
            Source src = new DOMSource(testDoc);
           
            //Setup Transformer to convert the area tree to a DOM
            TransformerHandler athandler = tfactory.newTransformerHandler();
            athandler.setResult(domres);
           
            //Setup FOP for area tree rendering
            FOUserAgent ua = effFactory.newFOUserAgent();
            ua.setBaseURL(testFile.getParentFile().toURL().toString());
            XMLRenderer atrenderer = new XMLRenderer();
            atrenderer.setUserAgent(ua);
            atrenderer.setContentHandler(athandler);
            ua.setRendererOverride(atrenderer);
            fop = effFactory.newFop(ua);
           
            SAXResult fores = new SAXResult(fop.getDefaultHandler());
            transformer.transform(src, fores);
        } finally {
            ElementListObserver.removeObserver(elCollector);
View Full Code Here

Examples of org.apache.fop.apps.FopFactory

            convertAttributeToProperty(attributes, attributeName,
                    attributeValue);
        }
       
        String attributeNS;
        FopFactory factory = getFObj().getUserAgent().getFactory();
        for (int i = 0; i < attributes.getLength(); i++) {
            /* convert all attributes with the same namespace as the fo element
             * the "xml:lang" property is a special case */
            attributeNS = attributes.getURI(i);
            attributeName = attributes.getQName(i);
            attributeValue = attributes.getValue(i);
            if (attributeNS == null || attributeNS.length() == 0
                    || "xml:lang".equals(attributeName)) {
                convertAttributeToProperty(attributes, attributeName, attributeValue);
            } else if (!factory.isNamespaceIgnored(attributeNS)) {
                ElementMapping mapping = factory.getElementMappingRegistry().getElementMapping(
                        attributeNS);
                if (mapping != null) {
                    QName attName = new QName(attributeNS, attributeName);
                    if (mapping.isAttributeProperty(attName)
                            && mapping.getStandardPrefix() != null) {
View Full Code Here

Examples of org.apache.fop.apps.FopFactory

    /**
     * Tests the rgb() function.
     * @throws Exception if an error occurs
     */
    public void testRGB() throws Exception {
        FopFactory fopFactory = FopFactory.newInstance();
        FOUserAgent ua = fopFactory.newFOUserAgent();
        Color colActual;
       
        colActual = ColorUtil.parseColorString(ua, "rgb(255, 40, 0)");
        assertEquals(255, colActual.getRed());
        assertEquals(40, colActual.getGreen());
View Full Code Here

Examples of org.apache.fop.apps.FopFactory

    /**
     * Tests the fop-rgb-icc() function.
     * @throws Exception if an error occurs
     */
    public void testRGBICC() throws Exception {
        FopFactory fopFactory = FopFactory.newInstance();
        ColorSpace cs = fopFactory.getColorSpace(null,
                "src/java/org/apache/fop/pdf/sRGB Color Space Profile.icm");
        assertNotNull(cs);
       
       
        FOUserAgent ua = fopFactory.newFOUserAgent();
        ColorExt colActual;
       
        //fop-rgb-icc() is used instead of rgb-icc() inside FOP!
        String colSpec = "fop-rgb-icc(1.0,0.0,0.0,sRGBAlt,"
            + "\"src/java/org/apache/fop/pdf/sRGB Color Space Profile.icm\",1.0,0.0,0.0)";
View Full Code Here

Examples of org.apache.fop.apps.FopFactory

            System.out.println("Output: PDF (" + pdffile + ")");
            System.out.println();
            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);
           
            try {
                // Construct fop with desired output format
                Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, out);
   
                // Setup XSLT
                TransformerFactory factory = TransformerFactory.newInstance();
                Transformer transformer = factory.newTransformer(new StreamSource(xsltfile));
               
View Full Code Here

Examples of org.apache.fop.apps.FopFactory

     * @return the list of {@link EmbedFontInfo} objects
     * @throws FOPException if an error occurs while processing the configuration
     */
    protected List/*<EmbedFontInfo>*/ buildFontList(Configuration cfg, FontResolver fontResolver,
                    FontEventListener listener) throws FOPException {
        FopFactory factory = userAgent.getFactory();
        FontManager fontManager = factory.getFontManager();
        if (fontResolver == null) {
            //Ensure that we have minimal font resolution capabilities
            fontResolver = FontManager.createMinimalFontResolver();
        }

        boolean strict = factory.validateUserConfigStrictly();

        //Read font configuration
        FontInfoConfigurator fontInfoConfigurator
            = new FontInfoConfigurator(cfg, fontManager, fontResolver, listener, strict);
        List/*<EmbedFontInfo>*/ fontInfoList = new java.util.ArrayList/*<EmbedFontInfo>*/();
 
View Full Code Here

Examples of org.apache.fop.apps.FopFactory

        }
        return testcase2checks;
    }

    public FopFactory getFopFactory(boolean base14KerningEnabled) {
        FopFactory effFactory = (base14KerningEnabled ? fopFactoryWithBase14Kerning : fopFactory);
        return effFactory;
    }
View Full Code Here

Examples of org.apache.fop.apps.FopFactory

        return effFactory;
    }

    public FopFactory getFopFactory(Document testDoc) {
        boolean base14KerningEnabled = isBase14KerningEnabled(testDoc);
        FopFactory effFactory = getFopFactory(base14KerningEnabled);

        boolean strictValidation = isStrictValidation(testDoc);
        effFactory.setStrictValidation(strictValidation);

        return effFactory;
    }
View Full Code Here

Examples of org.apache.fop.apps.FopFactory

    /**
     * Tests the rgb() function.
     * @throws Exception if an error occurs
     */
    public void testRGB() throws Exception {
        FopFactory fopFactory = FopFactory.newInstance();
        FOUserAgent ua = fopFactory.newFOUserAgent();
        Color colActual;

        colActual = ColorUtil.parseColorString(ua, "rgb(255, 40, 0)");
        assertEquals(255, colActual.getRed());
        assertEquals(40, colActual.getGreen());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.