xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Red Light <skydelt...@yahoo.com>
Subject embedding fonts and performance Issue
Date Tue, 09 Mar 2010 14:27:03 GMT
Hi,

in my reports in embedded fonts true the following configurations in my fop.cnf conf file:

*******************************************************************************************************
<font metrics-url="arialuni.xml" kerning="yes" embed-url="ARIALUNI.TTF">       
          
                    <font-triplet name="Arial Unicode MS" style="normal"
weight="normal"/>
                   <font-triplet name="Arial Unicode MS" style="normal" 
                 height="bold"/>                
        </font>   
        
        <font metrics-url="arial.xml" kerning="yes" embed-url="ARIAL.TTF">
          <font-triplet name="Arial" style="normal" weight="normal"/>       

        </font>
      
        <font metrics-url="arialbd.xml" kerning="yes" embed-url="file:ARIALBD.TTF">
          <font-triplet name="ArialBD" style="normal" weight="normal"/>       

        </font>
***************************************************************************************************

but i assign the generalFont path from my class ; the prob when i was using the default fonts
(Times) the performance were great like 1/2s max for the generation now  when i have embedded
the 3 arial font  my pdf is rendered like in 5/6s :( which too much 

any one experienced such problem (i'm using apache fop 0.95)?


part generation report class :

****************************************************************************************************

ByteArrayOutputStream out = null;
    
    try{
        System.setProperty("javax.xml.transform.TransformerFactory","org.apache.xalan.processor.TransformerFactoryImpl");
File baseDir = new File(request.getSession().getServletContext().getRealPath("/PDF"));
    File fontBaseDir = new File(request.getSession().getServletContext().getRealPath("/PDF/fonts"));

     
        Source xsltfile = new StreamSource(new File(baseDir, fileName));
         
         
         FopFactory fopFactory = FopFactory.newInstance();
         
          try {
             DefaultConfigurationBuilder cfgBuilder = new DefaultConfigurationBuilder();
             Configuration cfg = cfgBuilder.buildFromFile(baseDir+"\\fop.xconf");
             fopFactory.setFontBaseURL(fontBaseDir.toString()); 
             fopFactory.setUserConfig(cfg);    
        } catch (Exception e) {
            System.out.println("cause"+e.getCause());
            System.out.println("plz check that the conf file and the fonts are correctly
deployed or give more size to the JVM !");
        }
        
        
         FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
         
         
         out = new ByteArrayOutputStream();
             
        Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF,foUserAgent, out);
                     
        TransformerFactory tranFactory = TransformerFactory.newInstance(); 
        Transformer aTransformer = tranFactory.newTransformer(xsltfile); 

        StringReader xmlfile = new StringReader(reportStr.toString());
                 
        Source src = new StreamSource(xmlfile);
              
        
        Result res = new SAXResult(fop.getDefaultHandler());        
        aTransformer.transform(src, res);
                 

    }
    catch(TransformerException e)
    {
        e.printStackTrace();
        
    }
    
    .
    .
    /** rest of the code***/

****************************************************************************************************

and thanks



      
Mime
View raw message