RE: [afp-renderer-users] AFP Renderer Not Working
Brought to you by:
towny,
tumbarumba
From: Joe S. <jo...@ex...> - 2004-11-10 20:08:18
|
On Wed, 2004-11-10 at 15:35, Venkataramani, Prakash wrote: > Hai Joe, > > Thanks. > > OS: NT > JDK: 1.4 > Also afop-fonts.xml is looked up at jar file. > If I need to make a change in afp-fonts.xml > I will have change it locally and add it to > the jar file.have you encountered this situation ? We don't ever put afp-fonts.xml inside the jar. Rather, we stick it in a directory called "resources" or some such, and put that directory in the classpath. For example, our directory structure might look something like this: C:\afp +- lib | +- afp-renderer.jar | +- fop.jar | +- (more jars) +- resources +- afp-fonts.xml +- afp-font-resources +- T1V10285.CDP +- C0G21A00.240 +- (more font resources) With these directories, we can then start up to renderer using something like: java -cp C:/afp/lib/afp-renderer.jar;C:/afp/lib/fop.jar;c:/afp/resources FO2AFP input.fo output.afp Looking at the stack trace below, it looks like there has been a problem reading the code page file (it should be in the classpath). Can you confirm that you have the file T1V10285.CDP in the classpath? Cheers, Joe > In file AFPFontReader.java > > Section of the code where it fails. > String "data" is empty and obviosly when you do a substring it fails. > > StructuredFieldReader sfr = new StructuredFieldReader(is); > byte[] data = sfr.getNext(codepageSF); > System.out.println("Data:"+ data.length); > String stringData = new String(data, > AFPConstants.EBCIDIC_ENCODING); > //This is the place where it breaks. > String actualCodePage = stringData.substring(3, 11); > > > String index out of range: 11 > org.apache.fop.render.afp.exceptions.FontRuntimeException: Failed to load > the character set metrics for code page T1V10285; nested exception is > java.lang.StringIndexOutOfBoundsException > at > org.apache.fop.render.afp.fonts.AFPFontReader.loadCharacterSetMetric(AFPFont > Reader.java:200) > at > org.apache.fop.render.afp.fonts.CharacterSetMetric.load(CharacterSetMetric.j > ava:214) > at > org.apache.fop.render.afp.fonts.CharacterSetMetric.getAscender(CharacterSetM > etric.java:126) > at > org.apache.fop.render.afp.fonts.FontMetrics.getAscender(FontMetrics.java:86) > at org.apache.fop.layout.FontState.getAscender(FontState.java:143) > at org.apache.fop.layout.LineArea.<init>(LineArea.java:326) > at > org.apache.fop.layout.BlockArea.getCurrentLineArea(BlockArea.java:164) > at org.apache.fop.fo.FOText.addRealText(FOText.java:263) > at org.apache.fop.fo.FOText.addText(FOText.java:252) > at org.apache.fop.fo.FOText.layout(FOText.java:161) > at org.apache.fop.fo.flow.Block.layout(Block.java:257) > at org.apache.fop.fo.flow.AbstractFlow.layout(AbstractFlow.java:154) > at org.apache.fop.fo.flow.AbstractFlow.layout(AbstractFlow.java:110) > at > org.apache.fop.fo.pagination.PageSequence.makePage(PageSequence.java:400) > at > org.apache.fop.fo.pagination.PageSequence.format(PageSequence.java:338) > at > org.apache.fop.apps.StreamRenderer.render(StreamRenderer.java:262) > at > org.apache.fop.fo.FOTreeBuilder.endElement(FOTreeBuilder.java:223) > at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown > Source) > at > org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown > Source) > at > org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatc > her.dispatch(Unknown Source) > at > org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown > Source) > at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source) > at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source) > at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) > at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) > at org.apache.fop.apps.Driver.render(Driver.java:498) > at org.apache.fop.apps.Driver.run(Driver.java:565) > at gov.ssa.dps.document.FO2AFP.main(FO2AFP.java:53) > > > > Prakash > -----Original Message----- > From: Joe Schmetzer [mailto:jo...@ex...] > Sent: Wednesday, November 10, 2004 10:19 AM > To: Venkataramani, Prakash > Cc: afp...@li... > Subject: Re: [afp-renderer-users] AFP Renderer Not Working > > > On Wed, November 10, 2004 2:57 pm, Venkataramani, Prakash said: > > > > I am trying to get the AFP Renderer work.I tried the sample code As > > well as Junit testcase code,but of no luck. I took the source jar and > > started to look for as where it is Breaking.I found issues with > > AFPFontReader.java.(StringIndexOutofBoundsException) > > I havn't seen that particular issue before. Can you give us a bit more > detail about the particular error you are getting? Is there a stack trace? > You mentioned a StringIndexOutofBoundsException in AFPFontReader.java - are > you able to determine the line that caused the exception? Information about > your operating system, java version and classpath could be useful, too. > > > Was wondering any of you guys got in to the same issue.Has any one got > > AFP renderer to work. > > We're currently using it in production systems quite successfully. Once it's > configured correctly, things should Just Work (at least, that's the > plan) > > Cheers, > Joe |