This is getting increasingly away from FOP and closer to Batik.....nevertheless, I am continuing along this thread to get some more inputs.
I have added all the jar's under batik's lib folder into my project as well as my Weblogic domain (where other libraries are placed). However, when I try to run the application I get a java.lang.NoClassDefFoundError: org/apache/batik/transcoder/TranscoderException. Is there anything that I am missing. (I found a similar query by another person who was using Tomcat. The reply simply asked him to include the jars under the web container's lib directory). In my case, I have all the jar's already in my Weblogic's application folder. Thanks, Saptarshi. -----Original Message----- From: Jeremias Maerki [mailto:[EMAIL PROTECTED] Sent: Thursday, December 23, 2004 7:37 PM To: [EMAIL PROTECTED] Subject: Re: Handling multiple spaces Uh, now it gets complicated.... On 23.12.2004 14:32:56 Saptarshi Sen wrote: > Hi, > I got the desired output using Batik. I am now trying to integrate it > into my application. > > Since Batik uses the PDFTranscoder class from FOP, what are the > various jar's that I need to include in my project path. I understand that I > should remove the fop.jar (from version 0.20.5) from my project path. Which > are the jar's from batik 1.5.1 that I need to include. I think you need all JARs from the lib directory of the binary distribution except batik-svggen.jar and batik-swing.jar. Not sure. I'd have to do a trial-and-error. pdf-transcoder.jar contains all classes needed by FOP's PDF Transcoder. > A few requirements in my application is that I'll be embedding custom > fonts and using batik just for SVG to PDF conversion. Now for the tricky part. Font configuration for the new transcoder is not documented, yet, and it's a bit different than in FOP 0.20.5 and may even change again until the first release of the redesign code. Here's a snippet to create an Avalon Configuration Object with the font configuration: import org.apache.avalon.framework.configuration.Configuration; import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder; import org.apache.avalon.framework.container.ContainerUtil; import org.apache.batik.transcoder.Transcoder; import org.apache.batik.transcoder.TranscoderException; import org.apache.batik.transcoder.TranscoderInput; import org.apache.batik.transcoder.TranscoderOutput; import org.apache.batik.transcoder.XMLAbstractTranscoder; import org.apache.batik.transcoder.image.ImageTranscoder; [..] //Transcoder instantiation Transcoder transcoder = transcoder = new org.apache.fop.svg.PDFTranscoder(); [..] //Font configuration DefaultConfigurationBuilder cfgBuilder = new DefaultConfigurationBuilder(); Configuration cfg = cfgBuilder.buildFromFile(new File("src/xml/pdf-transcoder-cfg.xml")); ContainerUtil.configure(transcoder, cfg); [..] //Transcoder properties supported by the PDF Transcoder int dpi = 300; transcoder.addTranscodingHint(ImageTranscoder.KEY_PIXEL_UNIT_TO_MILLIMETER, new Float((float)(25.4 / dpi))); transcoder.addTranscodingHint(XMLAbstractTranscoder.KEY_XML_PARSER_VALIDATING , Boolean.FALSE); transcoder.addTranscodingHint(PDFTranscoder.KEY_STROKE_TEXT, Boolean.FALSE); [..] //On with the normal transcoding process as documented in Batik... The XML file for the font configuration would look approximately like this: <cfg> <fonts> <font metrics-url="file:C:/Dev/FOP/temp/fonts/FUTURAL.ttf.xml" kerning="no" embed-url="file:C:/Dev/FOP/Temp/fonts/FUTURAL.ttf"> <font-triplet name="Futura" style="normal" weight="200"/> <font-triplet name="Futura" style="normal" weight="normal"/> </font> <font metrics-url="file:C:\Dev\FOP\temp\fonts\ARIAL.TTF.xml" kerning="no" embed-url="file:C:/Dev/FOP/Temp/fonts/ARIAL.ttf"> <font-triplet name="Arial" style="normal" weight="normal"/> </font> <font metrics-url="file:C:\Dev\FOP\temp\fonts\ARIALBD.TTF.xml" kerning="no" embed-url="file:C:/Dev/FOP/Temp/fonts/ARIALBD.ttf"> <font-triplet name="Arial" style="normal" weight="bold"/> </font> </fonts> </cfg> There's one potential problem, though: I don't know what version of the PDF Transcoder is in the Batik 1.5.1 release. That part didn't get released properly. It could be that the font configuration doesn't work, but I hope so. Jeremias Maerki --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
----------------------------------------------------------------------------------------------------------------------------- Disclaimer ----------------------------------------------------------------------------------------------------------------------------- "This message(including attachment if any)is confidential and may be privileged.Before opening attachments please check them for viruses and defects.MindTree Consulting Private Limited (MindTree)will not be responsible for any viruses or defects or any forwarded attachments emanating either from within MindTree or outside.If you have received this message by mistake please notify the sender by return e-mail and delete this message from your system. Any unauthorized use or dissemination of this message in whole or in part is strictly prohibited. Please note that e-mails are susceptible to change and MindTree shall not be liable for any improper, untimely or incomplete transmission." -----------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]