aspose file tools*
The moose likes I/O and Streams and the fly likes how to embed Asian font while genrating PDF using FOP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "how to embed Asian font while genrating PDF using FOP" Watch "how to embed Asian font while genrating PDF using FOP" New topic
Author

how to embed Asian font while genrating PDF using FOP

sumit kushwaha
Greenhorn

Joined: Nov 11, 2008
Posts: 3
I have been trying to embed Asian font while genrating PDF using FOP. I am not able to get a break through in this. I need a help as to how to configure the whole thing like-
1) Where to keep my metric file,
2) i have created a fop.xconf file which has the following data
<renderers>
<renderer mime="application/pdf">
<fonts>

<font-triplet name="arialuni" style="normal" weight="normal"/>

</fonts>
</renderer>
</renderers>

3) the arialuni.ttf font is placed in my directory D:/HEAD/applications/promo/font/
and the metric file is placed in D:/HEAD/applications/promo/config/

4) In my java code i have the following code
FopFactory fopFactory = FopFactory.newInstance();
FOUserAgent userAgent = fopFactory.newFOUserAgent();
File userConfigXml = new File("D:/HEAD/applications/proj/config/fop.xconf");

fopFactory.setUserConfig(userConfigXml);
fopFactory.setFontBaseURL("D:/HEAD/applications/proj/font/");

TransformerFactory transformerFactory = TransformerFactory.newInstance();
File copyrightFile = new File(fileUpLoadTempDir + copyrightPdfFileName);
outputStream = new FileOutputStream(copyrightFile);
outputStream = new BufferedOutputStream(outputStream);
Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, userAgent, outputStream);
Transformer transformer = transformerFactory.newTransformer(new StreamSource(xslSource));
Source src = new DOMSource(copyrightDom);
Result res = new SAXResult(fop.getDefaultHandler());
transformer.transform(src, res);

This is all i have done till now. I am trying to call the fop.xconf file from my java code.
Still i am getting # for the Asian Character.
Definitly i am missing somethign or the whole process should not be done this way.
Please some one help me out to resolve this.
Thankyou

Regards
Sumit

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to embed Asian font while genrating PDF using FOP