Hey
I am trying to convert an XML file to a PDF, which contains Hebrew
characters, using Font Arial.

The configuration file relevant code: 
<renderers>
<renderer mime="application/pdf">
<fonts>
 <!--  automatically detect operating system installed fonts  --> 
  <auto-detect /> 
</fonts>
 </renderer>
 </renderers>

The relevant code for creating the pdf after converting the .xml to .fo:

FopFactory fopFactory = FopFactory.newInstance();               
DefaultConfigurationBuilder cfgBuilder = new DefaultConfigurationBuilder();
Configuration cfg = cfgBuilder.buildFromFile(new
File("M:"+File.separator+"eitdev"+File.separator+"rte"+File.separator+"eit"+File.separator+"pdmdev"+File.separator+"conf"+File.separator+"xml_xsl2pdf"+File.separator+"Fopconfig.xml"));
                        
fopFactory.setUserConfig(cfg);          

//Creating the outputpd file name, same as the xml file with the extension
.xls
 int vIndex=aXmlFileFullPath.lastIndexOf("\\");           
String vXMLFileName=aXmlFileFullPath.substring(vIndex);
String
vPdfPathFile=aPDFFullPathDestination+vXMLFileName.replace("xml","pdf");
                        
// Step 2: Set up output stream.
// Note: Using BufferedOutputStream for performance reasons (helpful with
FileOutputStreams).
OutputStream out = new BufferedOutputStream(new FileOutputStream(new
File(vPdfPathFile)));

                        
 // Step 3: Construct fop with desired output format
(****)Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF,out);                  
  
                          
 // Step 4: Setup JAXP using identity transformer
TransformerFactory factory = TransformerFactory.newInstance();
 Transformer transformer = factory.newTransformer(); // identity transformer
 
// Step 5: Setup input and output for XSLT transformation 
  // Setup input stream
 Source src = new StreamSource(new File(iFoPathFile));
 // Resulting SAX events (the generated FO) must be piped through to FOP
 Result res = new SAXResult(fop.getDefaultHandler());
                                    
 // Step 6: Start XSLT transformation and FOP processing
 transformer.transform(src, res);               
 //Clean-up
  out.close();

I was able to produce the desired document, but when trying to run the code
under different PC (which assumes to be more powerful!!!) I got this weird
exception: java heap space! The xml file was containing only one record and
I am convince it is not a memory issue! The exception accurse at the call :
(****)Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF,out);

When deleting the below configuration lines, I was able to produce the pdf
without  Hebrew font instead got the ### mark :
DefaultConfigurationBuilder cfgBuilder = new DefaultConfigurationBuilder();     
        
Configuration cfg = cfgBuilder.buildFromFile(new File("….."));
fopFactory.setUserConfig(cfg);

I hope someone can help me, I was working very hard to manipulate FOP to
show Hebrew and now I have encountered this problem which I really can't
figure out. Sorry for the long post!

Thanks,Natalie
 

-- 
View this message in context: 
http://old.nabble.com/auto-detect--fonts-tp28846239p28846239.html
Sent from the FOP - Users mailing list archive at Nabble.com.


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

Reply via email to