FOP 2.0 - SVG to PDF font rendering.

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

FOP 2.0 - SVG to PDF font rendering.

Maciej Płaza
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.    


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Example.png (17K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: FOP 2.0 - SVG to PDF font rendering.

Chris Bowditch
Hi Maciej,

Can you attach the full XSL-FO Fil?. I didn't understand the snippet you
sent wykres element is not a valid XSL-FO element

Thanks

Chris

On 07/12/2015 11:40, Maciej Płaza wrote:

> 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.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]