xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Maciej Płaza <maciej.pl...@geosolution.pl>
Subject FOP 2.0 - SVG to PDF font rendering.
Date Mon, 07 Dec 2015 11:40:05 GMT
Hi.

I have quite big problem with fonts rendering using FOP 2.0 with Batik 
1.8. Every char has grey border around it and I don't know why. With FOP 
1.1 and Batik 1.7 everything works ok. When I export my SVG before 
transforming it to PDF everything is ok too.
Example.png - screenshot of result PDF.

My fop.xconf:

    <?xml version="1.0"?>
    <fop version="1.0">
       <source-resolution>72</source-resolution>
    <target-resolution>300</target-resolution>
       <default-page-settings height="11in" width="8.26in"/>

       <renderers>
         <renderer mime="application/pdf">
           <filterList>
             <value>flate</value>
           </filterList>

           <fonts>
    <directory>/home/tomcat/fonts</directory>
    <directory>c:/windows/fonts</directory>
            <autodetect/>
           </fonts>
         </renderer>

         <renderer mime="application/postscript">
         </renderer>

         <renderer mime="application/vnd.hp-PCL">
         </renderer>

         <renderer mime="image/svg+xml">
           <format type="paginated"/>
           <link value="true"/>
           <strokeText value="false"/>
         </renderer>

         <renderer mime="application/awt">
         </renderer>

         <renderer mime="image/png">
         </renderer>

         <renderer mime="image/tiff">
         </renderer>

         <renderer mime="text/xml">
         </renderer>

         <renderer mime="text/plain">
           <pageSize columns="80"/>
         </renderer>
       </renderers>
    </fop>

Part of the layout where SVG is embeded (<wykres/> is imported as 
instream-foreign-object tag):

    <fo:block-container absolute-position="absolute" height="175.56mm"
    left="5mm" top="75mm" width="175.42mm" >
         <fo:block text-align="center">
             <wykres/>
         </fo:block>
    </fo:block-container>

Java code (pdfStream is ByteArrayOutputStream):

    DefaultConfigurationBuilder cfgBuilder = new
    DefaultConfigurationBuilder();
    Configuration cfg = cfgBuilder.buildFromFile(new File(absPath));
    FopFactoryBuilder fopFactoryBuilder = new FopFactoryBuilder(new
    File(ProfilePath.getFopPath()).toURI()).setConfiguration(cfg);
    FopFactory fopFactory = fopFactoryBuilder.build();
    Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, pdfStream);

    Source src = new DOMSource(fopDocument);
    Result res = new SAXResult(fop.getDefaultHandler());

    Transformer transformer =
    TransformerFactory.newInstance().newTransformer();
    transformer.transform(src, res);

Can anyone help?

Regards,
Maciej Płaza.

Mime
View raw message