I think you need to identify the EAN128 fields that are contained within the string. This is an example I use in my Commander4j application

<?xml version="1.0"?>
<!DOCTYPE barcode SYSTEM "barcode4j.dtd">
<barcode>
  <ean-128>
      <height>15mm</height>
      <module-width>0.3mm</module-width>
      <check-digit-marker>&#xF0;</check-digit-marker>
      <group-separator>&#xF1;</group-separator>
      <template>(01)n14(20)n2(17)n6(37)n4(10)an1-20</template>
      <quiet-zone enabled="true">5mm</quiet-zone>
      <human-readable>
          <placement>bottom</placement>
          <font-name>Helvetica</font-name>
          <font-size>6pt</font-size>
          <omit-brackets>false</omit-brackets>
      </human-readable>
  </ean-128>
</barcode>


On 24 Sep 2012, at 14:43, Barcodetest Bacordetest <barcodetest45@yahoo.com> wrote:

Hello,
I have a problem with barcode type ean 128:
When I use as input the following string:
415809999900167180201121030460302950433902026501

I obtain the following errors:
SEVERE: Exception
     [exec] org.apache.fop.apps.FOPException: Variable length field "1121030460302950433902026501" too long! Length should be 25 at the most! Accepted start of Message: "(415)8099999001671(8020)"
     [exec] java.lang.IllegalArgumentException: Variable length field "1121030460302950433902026501" too long! Length should be 25 at the most! Accepted start of Message: "(415)8099999001671(8020)"
     [exec]     at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:302)
     [exec]     at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:130)
     [exec]     at org.apache.fop.cli.Main.startFOP(Main.java:177)
     [exec]     at org.apache.fop.cli.Main.main(Main.java:208)
     [exec] Caused by: java.lang.IllegalArgumentException: Variable length field "1121030460302950433902026501" too long! Length should be 25 at the most! Accepted start of Message: "(415)8099999001671(8020)"
     [exec]     at org.krysalis.barcode4j.impl.code128.EAN128LogicImpl.getException(EAN128LogicImpl.java:368)
     [exec]     at org.krysalis.barcode4j.impl.code128.EAN128LogicImpl.getException(EAN128LogicImpl.java:357)
     [exec]     at org.krysalis.barcode4j.impl.code128.EAN128LogicImpl.addAI(EAN128LogicImpl.java:215)
     [exec]     at org.krysalis.barcode4j.impl.code128.EAN128LogicImpl.addAIs(EAN128LogicImpl.java:146)
     [exec]     at org.krysalis.barcode4j.impl.code128.EAN128LogicImpl.setMessage(EAN128LogicImpl.java:77)
     [exec]     at org.krysalis.barcode4j.impl.code128.EAN128LogicImpl.getEncodedMessage(EAN128LogicImpl.java:99)
     [exec]     at org.krysalis.barcode4j.impl.code128.EAN128Bean.calcDimensions(EAN128Bean.java:56)
     [exec]     at org.krysalis.barcode4j.impl.ConfigurableBarcodeGenerator.calcDimensions(ConfigurableBarcodeGenerator.java:179)
     [exec]     at org.krysalis.barcode4j.fop.BarcodeElement.getDimension(BarcodeElement.java:79)
     [exec]     at org.apache.fop.fo.flow.InstreamForeignObject.prepareIntrinsicSize(InstreamForeignObject.java:106)
     [exec]     at org.apache.fop.fo.flow.InstreamForeignObject.getIntrinsicWidth(InstreamForeignObject.java:119)
     [exec]     at org.apache.fop.layoutmgr.inline.AbstractGraphicsLayoutManager.getInlineArea(AbstractGraphicsLayoutManager.java:59)
     [exec]     at org.apache.fop.layoutmgr.inline.AbstractGraphicsLayoutManager.getNextKnuthElements(AbstractGraphicsLayoutManager.java:109)
     [exec]     at org.apache.fop.layoutmgr.inline.LineLayoutManager.collectInlineKnuthElements(LineLayoutManager.java:639)
     [exec]     at org.apache.fop.layoutmgr.inline.LineLayoutManager.getNextKnuthElements(LineLayoutManager.java:579)
     [exec]     at org.apache.fop.layoutmgr.BlockStackingLayoutManager.getNextChildElements(BlockStackingLayoutManager.java:571)
     [exec]     at org.apache.fop.layoutmgr.BlockStackingLayoutManager.getNextChildElements(BlockStackingLayoutManager.java:552)
     [exec]     at org.apache.fop.layoutmgr.BlockStackingLayoutManager.getNextKnuthElements(BlockStackingLayoutManager.java:280)
     [exec]     at org.apache.fop.layoutmgr.BlockLayoutManager.getNextKnuthElements(BlockLayoutManager.java:123)
     [exec]     at org.apache.fop.layoutmgr.BlockLayoutManager.getNextKnuthElements(BlockLayoutManager.java:115)
     [exec]     at org.apache.fop.layoutmgr.table.TableCellLayoutManager.getNextKnuthElements(TableCellLayoutManager.java:153)
     [exec]     at org.apache.fop.layoutmgr.table.RowGroupLayoutManager.createElementsForRowGroup(RowGroupLayoutManager.java:119)
     [exec]     at org.apache.fop.layoutmgr.table.RowGroupLayoutManager.getNextKnuthElements(RowGroupLayoutManager.java:62)
     [exec]     at org.apache.fop.layoutmgr.table.TableContentLayoutManager.getKnuthElementsForRowIterator(TableContentLayoutManager.java:220)
     [exec]     at org.apache.fop.layoutmgr.table.TableContentLayoutManager.getNextKnuthElements(TableContentLayoutManager.java:173)
     [exec]     at org.apache.fop.layoutmgr.table.TableLayoutManager.getNextKnuthElements(TableLayoutManager.java:253)
     [exec]     at org.apache.fop.layoutmgr.FlowLayoutManager.getNextChildElements(FlowLayoutManager.java:199)
     [exec]     at org.apache.fop.layoutmgr.FlowLayoutManager.addChildElements(FlowLayoutManager.java:140)
     [exec]     at org.apache.fop.layoutmgr.FlowLayoutManager.addChildElements(FlowLayoutManager.java:129)
     [exec]     at org.apache.fop.layoutmgr.FlowLayoutManager.getNextKnuthElements(FlowLayoutManager.java:70)
     [exec]     at org.apache.fop.layoutmgr.PageBreaker.getNextKnuthElements(PageBreaker.java:216)
     [exec]     at org.apache.fop.layoutmgr.AbstractBreaker.getNextBlockList(AbstractBreaker.java:692)
     [exec]     at org.apache.fop.layoutmgr.PageBreaker.getNextBlockList(PageBreaker.java:149)
     [exec]     at org.apache.fop.layoutmgr.PageBreaker.getNextBlockList(PageBreaker.java:132)
     [exec]     at org.apache.fop.layoutmgr.AbstractBreaker.doLayout(AbstractBreaker.java:337)
     [exec]     at org.apache.fop.layoutmgr.PageBreaker.doLayout(PageBreaker.java:85)
     [exec]     at org.apache.fop.layoutmgr.PageSequenceLayoutManager.activateLayout(PageSequenceLayoutManager.java:107)
     [exec]     at org.apache.fop.area.AreaTreeHandler.endPageSequence(AreaTreeHandler.java:238)
     [exec]     at org.apache.fop.fo.pagination.PageSequence.endOfNode(PageSequence.java:120)
     [exec]     at org.apache.fop.fo.FOTreeBuilder$MainFOHandler.endElement(FOTreeBuilder.java:349)
     [exec]     at org.apache.fop.fo.FOTreeBuilder.endElement(FOTreeBuilder.java:177)
     [exec]     at org.apache.xalan.transformer.TransformerIdentityImpl.endElement(TransformerIdentityImpl.java:1101)
     [exec]     at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
     [exec]     at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source)
     [exec]     at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
     [exec]     at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
     [exec]     at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
     [exec]     at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
     [exec]     at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
     [exec]     at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
     [exec]     at org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:484)
     [exec]     at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:299)
     [exec]     ... 3 more
     [exec] ---------
     [exec] java.lang.IllegalArgumentException: Variable length field "1121030460302950433902026501" too long! Length should be 25 at the most! Accepted start of Message: "(415)8099999001671(8020)"
     [exec]     at org.krysalis.barcode4j.impl.code128.EAN128LogicImpl.getException(EAN128LogicImpl.java:368)
     [exec]     at org.krysalis.barcode4j.impl.code128.EAN128LogicImpl.getException(EAN128LogicImpl.java:357)
     [exec]     at org.krysalis.barcode4j.impl.code128.EAN128LogicImpl.addAI(EAN128LogicImpl.java:215)
     [exec]     at org.krysalis.barcode4j.impl.code128.EAN128LogicImpl.addAIs(EAN128LogicImpl.java:146)
     [exec]     at org.krysalis.barcode4j.impl.code128.EAN128LogicImpl.setMessage(EAN128LogicImpl.java:77)
     [exec]     at org.krysalis.barcode4j.impl.code128.EAN128LogicImpl.getEncodedMessage(EAN128LogicImpl.java:99)
     [exec]     at org.krysalis.barcode4j.impl.code128.EAN128Bean.calcDimensions(EAN128Bean.java:56)
     [exec]     at org.krysalis.barcode4j.impl.ConfigurableBarcodeGenerator.calcDimensions(ConfigurableBarcodeGenerator.java:179)
     [exec]     at org.krysalis.barcode4j.fop.BarcodeElement.getDimension(BarcodeElement.java:79)
     [exec]     at org.apache.fop.fo.flow.InstreamForeignObject.prepareIntrinsicSize(InstreamForeignObject.java:106)
     [exec]     at org.apache.fop.fo.flow.InstreamForeignObject.getIntrinsicWidth(InstreamForeignObject.java:119)
     [exec]     at org.apache.fop.layoutmgr.inline.AbstractGraphicsLayoutManager.getInlineArea(AbstractGraphicsLayoutManager.java:59)
     [exec]     at org.apache.fop.layoutmgr.inline.AbstractGraphicsLayoutManager.getNextKnuthElements(AbstractGraphicsLayoutManager.java:109)
     [exec]     at org.apache.fop.layoutmgr.inline.LineLayoutManager.collectInlineKnuthElements(LineLayoutManager.java:639)
     [exec]     at org.apache.fop.layoutmgr.inline.LineLayoutManager.getNextKnuthElements(LineLayoutManager.java:579)
     [exec]     at org.apache.fop.layoutmgr.BlockStackingLayoutManager.getNextChildElements(BlockStackingLayoutManager.java:571)
     [exec]     at org.apache.fop.layoutmgr.BlockStackingLayoutManager.getNextChildElements(BlockStackingLayoutManager.java:552)
     [exec]     at org.apache.fop.layoutmgr.BlockStackingLayoutManager.getNextKnuthElements(BlockStackingLayoutManager.java:280)
     [exec]     at org.apache.fop.layoutmgr.BlockLayoutManager.getNextKnuthElements(BlockLayoutManager.java:123)
     [exec]     at org.apache.fop.layoutmgr.BlockLayoutManager.getNextKnuthElements(BlockLayoutManager.java:115)
     [exec]     at org.apache.fop.layoutmgr.table.TableCellLayoutManager.getNextKnuthElements(TableCellLayoutManager.java:153)
     [exec]     at org.apache.fop.layoutmgr.table.RowGroupLayoutManager.createElementsForRowGroup(RowGroupLayoutManager.java:119)
     [exec]     at org.apache.fop.layoutmgr.table.RowGroupLayoutManager.getNextKnuthElements(RowGroupLayoutManager.java:62)
     [exec]     at org.apache.fop.layoutmgr.table.TableContentLayoutManager.getKnuthElementsForRowIterator(TableContentLayoutManager.java:220)
     [exec]     at org.apache.fop.layoutmgr.table.TableContentLayoutManager.getNextKnuthElements(TableContentLayoutManager.java:173)
     [exec]     at org.apache.fop.layoutmgr.table.TableLayoutManager.getNextKnuthElements(TableLayoutManager.java:253)
     [exec]     at org.apache.fop.layoutmgr.FlowLayoutManager.getNextChildElements(FlowLayoutManager.java:199)
     [exec]     at org.apache.fop.layoutmgr.FlowLayoutManager.addChildElements(FlowLayoutManager.java:140)
     [exec]     at org.apache.fop.layoutmgr.FlowLayoutManager.addChildElements(FlowLayoutManager.java:129)
     [exec]     at org.apache.fop.layoutmgr.FlowLayoutManager.getNextKnuthElements(FlowLayoutManager.java:70)
     [exec]     at org.apache.fop.layoutmgr.PageBreaker.getNextKnuthElements(PageBreaker.java:216)
     [exec]     at org.apache.fop.layoutmgr.AbstractBreaker.getNextBlockList(AbstractBreaker.java:692)
     [exec]     at org.apache.fop.layoutmgr.PageBreaker.getNextBlockList(PageBreaker.java:149)
     [exec]     at org.apache.fop.layoutmgr.PageBreaker.getNextBlockList(PageBreaker.java:132)
     [exec]     at org.apache.fop.layoutmgr.AbstractBreaker.doLayout(AbstractBreaker.java:337)
     [exec]     at org.apache.fop.layoutmgr.PageBreaker.doLayout(PageBreaker.java:85)
     [exec]     at org.apache.fop.layoutmgr.PageSequenceLayoutManager.activateLayout(PageSequenceLayoutManager.java:107)
     [exec]     at org.apache.fop.area.AreaTreeHandler.endPageSequence(AreaTreeHandler.java:238)
     [exec]     at org.apache.fop.fo.pagination.PageSequence.endOfNode(PageSequence.java:120)
     [exec]     at org.apache.fop.fo.FOTreeBuilder$MainFOHandler.endElement(FOTreeBuilder.java:349)
     [exec]     at org.apache.fop.fo.FOTreeBuilder.endElement(FOTreeBuilder.java:177)
     [exec]     at org.apache.xalan.transformer.TransformerIdentityImpl.endElement(TransformerIdentityImpl.java:1101)
     [exec]     at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
     [exec]     at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source)
     [exec]     at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
     [exec]     at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
     [exec]     at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
     [exec]     at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
     [exec]     at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
     [exec]     at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
     [exec]     at org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:484)
     [exec]     at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:299)
     [exec]     at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:130)
     [exec]     at org.apache.fop.cli.Main.startFOP(Main.java:177)
     [exec]     at org.apache.fop.cli.Main.main(Main.java:208)

I know that is possible to use string like that.
My configuration is below:

<fo:block>
                                <fo:instream-foreign-object>
                                    <bc:barcode xmlns:bc="http://barcode4j.krysalis.org/ns" message="415809999900167180201121030460302950433902026501" render-mode="svg" id="fieldUpc">
                                        <bc:ean128>
                                            <bc:quiet-zone>10mm</bc:quiet-zone>
                                            <height>15mm</height>
                                            <module-width>0.28mm</module-width>
                                            <bc:human-readable>
                                                <bc:omit-brackets>false</bc:omit-brackets>
                                            </bc:human-readable>
                                        </bc:ean128>
                                    </bc:barcode>
                                </fo:instream-foreign-object>
                            </fo:block>

Where the problem is?
Does a parameter configuration exist that I don't know?

I'm really stuck.. :-(
Thank you very much!!!

roberto
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/_______________________________________________
Barcode4j-users mailing list
Barcode4j-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/barcode4j-users