You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by "Doherty, Michael" <Mi...@lehman.COM> on 2003/02/13 11:44:59 UTC

clipping text in

Hi,

I am trying to clip some text within an SVG block using FOP.  Below I attach
a version of the FOP-XML I am using.  When run with fop.sh that comes with
the FOP distribution (version 0.20.4), it works fine and clips as expected -
varying the clipPath's width will show more or less text accordingly.
However, when I pass the FOP-XML to my processor (a servlet) I get the
NullPointerException shown after the XML.  It seems to be caused by the url
not being found but I am at a loss as how to tell the processor that I want
to refer to the document itself.  Is there a configuration parameter that
needs to be set?  Is there another way to pass in the reference to the
clipPath?

Note that I have tried replacing the clip-path attribute with both of the
following which, although they avoid the error, fail to clip the text.

clip-path:#xpointer(#4203)
clip-path:#xpointer(id(4203))

Any help would be greatly appreciated,
Michael

FOP-XML:

<?xml version="1.0" encoding="utf-8"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:svg="http://www.w3.org/2000/svg">   
<!-- defines the layout master --> 
  <fo:layout-master-set>   
    <fo:simple-page-master margin-bottom="1cm" margin-left="1.5cm"
margin-right="1.5cm"
            margin-top="1cm" master-name="only" page-height="29.7cm"
            page-width="21cm">
      <fo:region-before extent="2cm"/>
      <fo:region-body margin-bottom="4.5cm" margin-top="2cm"/>
      <fo:region-after extent="5.5cm"/>
    </fo:simple-page-master> 
  </fo:layout-master-set>    
<!-- starts actual layout -->   
  <fo:page-sequence master-reference="only">  
    <fo:flow flow-name="xsl-region-body">
      <fo:table border-style="none" border-width="0.5pt">
        <fo:table-column column-width="18cm"/>
        <fo:table-body>
          <fo:table-row border-style="none" border-width="0.5pt">
            <fo:table-cell text-align="center" width="18cm">
              <fo:block text-align="center">
                <fo:instream-foreign-object height="20cm" width="17.6cm">
<!-- SVG Starts Here -->
                  <svg:svg style='clip-rule:nonzero; font-size:12pt;
stroke-width:1pt;' width='600pt' height='752pt'>
                    <svg:g transform='scale(1.0)' align='center'>
                      <svg:clipPath id='4203'><svg:rect x='118' y='0'
width='50' height='22'/></svg:clipPath>
                      <svg:text x='121' y='18' style='font-weight:normal;
fill:rgb(0, 0, 0); font-size:9.35pt;
clip-path:url(#4203)'>04-Jan-99&#160;to&#160;11-Feb-03</svg:text>
                    </svg:g>
                  </svg:svg>
                </fo:instream-foreign-object>
              </fo:block>
            </fo:table-cell>
          </fo:table-row>
        </fo:table-body>
      </fo:table>
    </fo:flow>
  </fo:page-sequence>
</fo:root>

Error message:

2003-02-13 09:32:30,411 INFO  [STDOUT] [ERROR] 
2003-02-13 09:32:30,412 INFO  [STDOUT] svg graphic could not be built: null
2003-02-13 09:32:30,413 INFO  [STDOUT] java.lang.NullPointerException
2003-02-13 09:32:30,417 INFO  [STDOUT]  at java.net.URL.<init>(URL.java:366)
2003-02-13 09:32:30,418 INFO  [STDOUT]  at java.net.URL.<init>(URL.java:329)
2003-02-13 09:32:30,419 INFO  [STDOUT]  at java.net.URL.<init>(URL.java:321)
2003-02-13 09:32:30,420 INFO  [STDOUT]  at java.net.URL.<init>(URL.java:252)
2003-02-13 09:32:30,421 INFO  [STDOUT]  at java.net.URL.<init>(URL.java:275)
2003-02-13 09:32:30,421 INFO  [STDOUT]  at
org.apache.batik.util.ParsedURLData.buildURL(Unknown Source)
2003-02-13 09:32:30,422 INFO  [STDOUT]  at
org.apache.batik.util.ParsedURLData.openStreamInternal(Unknown Source)
2003-02-13 09:32:30,423 INFO  [STDOUT]  at
org.apache.batik.util.ParsedURLData.openStream(Unknown Source)
2003-02-13 09:32:30,424 INFO  [STDOUT]  at
org.apache.batik.util.ParsedURL.openStream(Unknown Source)
2003-02-13 09:32:30,425 INFO  [STDOUT]  at
org.apache.batik.dom.svg.SAXSVGDocumentFactory.createDocument(Unknown
Source)
2003-02-13 09:32:30,425 INFO  [STDOUT]  at
org.apache.batik.bridge.DocumentLoader.loadDocument(Unknown Source)
2003-02-13 09:32:30,426 INFO  [STDOUT]  at
org.apache.batik.bridge.URIResolver.getNode(Unknown Source)
2003-02-13 09:32:30,427 INFO  [STDOUT]  at
org.apache.batik.bridge.URIResolver.getElement(Unknown Source)
2003-02-13 09:32:30,428 INFO  [STDOUT]  at
org.apache.batik.bridge.BridgeContext.getReferencedElement(Unknown Source)
2003-02-13 09:32:30,429 INFO  [STDOUT]  at
org.apache.batik.bridge.CSSUtilities.convertClipPath(Unknown Source)
2003-02-13 09:32:30,430 INFO  [STDOUT]  at
org.apache.batik.bridge.SVGTextElementBridge.buildGraphicsNode(Unknown
Source)
2003-02-13 09:32:30,430 INFO  [STDOUT]  at
org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(Unknown Source)
2003-02-13 09:32:30,431 INFO  [STDOUT]  at
org.apache.batik.bridge.GVTBuilder.buildComposite(Unknown Source)
2003-02-13 09:32:30,432 INFO  [STDOUT]  at
org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(Unknown Source)
2003-02-13 09:32:30,433 INFO  [STDOUT]  at
org.apache.batik.bridge.GVTBuilder.buildComposite(Unknown Source)
2003-02-13 09:32:30,434 INFO  [STDOUT]  at
org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(Unknown Source)
2003-02-13 09:32:30,434 INFO  [STDOUT]  at
org.apache.batik.bridge.GVTBuilder.buildComposite(Unknown Source)
2003-02-13 09:32:30,435 INFO  [STDOUT]  at
org.apache.batik.bridge.GVTBuilder.build(Unknown Source)
2003-02-13 09:32:30,436 INFO  [STDOUT]  at
org.apache.fop.render.pdf.PDFRenderer.renderSVGDocument(Unknown Source)
2003-02-13 09:32:30,437 INFO  [STDOUT]  at
org.apache.fop.render.pdf.PDFRenderer.renderSVGArea(Unknown Source)
2003-02-13 09:32:30,438 INFO  [STDOUT]  at
org.apache.fop.svg.SVGArea.render(Unknown Source)
2003-02-13 09:32:30,438 INFO  [STDOUT]  at
org.apache.fop.render.pdf.PDFRenderer.renderForeignObjectArea(Unknown
Source)
2003-02-13 09:32:30,439 INFO  [STDOUT]  at
org.apache.fop.layout.inline.ForeignObjectArea.render(Unknown Source)
2003-02-13 09:32:30,440 INFO  [STDOUT]  at
org.apache.fop.render.AbstractRenderer.renderLineArea(Unknown Source)
2003-02-13 09:32:30,441 INFO  [STDOUT]  at
org.apache.fop.layout.LineArea.render(Unknown Source)
2003-02-13 09:32:30,442 INFO  [STDOUT]  at
org.apache.fop.render.AbstractRenderer.renderBlockArea(Unknown Source)
2003-02-13 09:32:30,443 INFO  [STDOUT]  at
org.apache.fop.layout.BlockArea.render(Unknown Source)
2003-02-13 09:32:30,443 INFO  [STDOUT]  at
org.apache.fop.render.AbstractRenderer.renderAreaContainer(Unknown Source)
2003-02-13 09:32:30,444 INFO  [STDOUT]  at
org.apache.fop.layout.AreaContainer.render(Unknown Source)
2003-02-13 09:32:30,445 INFO  [STDOUT]  at
org.apache.fop.render.AbstractRenderer.renderAreaContainer(Unknown Source)
2003-02-13 09:32:30,446 INFO  [STDOUT]  at
org.apache.fop.layout.AreaContainer.render(Unknown Source)
2003-02-13 09:32:30,447 INFO  [STDOUT]  at
org.apache.fop.render.AbstractRenderer.renderAreaContainer(Unknown Source)
2003-02-13 09:32:30,447 INFO  [STDOUT]  at
org.apache.fop.layout.AreaContainer.render(Unknown Source)
2003-02-13 09:32:30,448 INFO  [STDOUT]  at
org.apache.fop.render.AbstractRenderer.renderAreaContainer(Unknown Source)
2003-02-13 09:32:30,449 INFO  [STDOUT]  at
org.apache.fop.layout.AreaContainer.render(Unknown Source)
2003-02-13 09:32:30,450 INFO  [STDOUT]  at
org.apache.fop.render.AbstractRenderer.renderAreaContainer(Unknown Source)
2003-02-13 09:32:30,451 INFO  [STDOUT]  at
org.apache.fop.layout.ColumnArea.render(Unknown Source)
2003-02-13 09:32:30,452 INFO  [STDOUT]  at
org.apache.fop.render.AbstractRenderer.renderSpanArea(Unknown Source)
2003-02-13 09:32:30,453 INFO  [STDOUT]  at
org.apache.fop.layout.SpanArea.render(Unknown Source)
2003-02-13 09:32:30,454 INFO  [STDOUT]  at
org.apache.fop.render.AbstractRenderer.renderBodyAreaContainer(Unknown
Source)
2003-02-13 09:32:30,454 INFO  [STDOUT]  at
org.apache.fop.render.pdf.PDFRenderer.renderPage(Unknown Source)
2003-02-13 09:32:30,455 INFO  [STDOUT]  at
org.apache.fop.render.pdf.PDFRenderer.render(Unknown Source)
2003-02-13 09:32:30,456 INFO  [STDOUT]  at
org.apache.fop.apps.StreamRenderer.queuePage(Unknown Source)
2003-02-13 09:32:30,457 INFO  [STDOUT]  at
org.apache.fop.layout.AreaTree.addPage(Unknown Source)
2003-02-13 09:32:30,458 INFO  [STDOUT]  at
org.apache.fop.fo.pagination.PageSequence.format(Unknown Source)
2003-02-13 09:32:30,458 INFO  [STDOUT]  at
org.apache.fop.apps.StreamRenderer.render(Unknown Source)
2003-02-13 09:32:30,459 INFO  [STDOUT]  at
org.apache.fop.fo.FOTreeBuilder.endElement(Unknown Source)
2003-02-13 09:32:30,460 INFO  [STDOUT]  at
org.apache.xerces.parsers.SAXParser.endElement(SAXParser.java:1398)
2003-02-13 09:32:30,461 INFO  [STDOUT]  at
org.apache.xerces.validators.common.XMLValidator.callEndElement(XMLValidator
.java:850)
2003-02-13 09:32:30,462 INFO  [STDOUT]  at
org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XM
LDocumentScanner.java:1200)
2003-02-13 09:32:30,463 INFO  [STDOUT]  at
org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.
java:380)
2003-02-13 09:32:30,464 INFO  [STDOUT]  at
org.apache.xerces.framework.XMLParser.parse(XMLParser.java:861)
2003-02-13 09:32:30,465 INFO  [STDOUT]  at
org.apache.fop.apps.Driver.render(Unknown Source)


------------------------------------------------------------------------------
This message is intended only for the personal and confidential use of the designated recipient(s) named above.  If you are not the intended recipient of this message you are hereby notified that any review, dissemination, distribution or copying of this message is strictly prohibited.  This communication is for information purposes only and should not be regarded as an offer to sell or as a solicitation of an offer to buy any financial product, an official confirmation of any transaction, or as an official statement of Lehman Brothers.  Email transmission cannot be guaranteed to be secure or error-free.  Therefore, we do not represent that this information is complete or accurate and it should not be relied upon as such.  All information is subject to change without notice.



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: clipping text in

Posted by Jeremias Maerki <de...@greenmail.ch>.
This is a bug in 0.20.4 that has been corrected in 0.20.5rc. I suggest
you upgrade.

On 13.02.2003 11:44:59 Doherty, Michael wrote:
> I am trying to clip some text within an SVG block using FOP.  Below I attach
> a version of the FOP-XML I am using.  When run with fop.sh that comes with
> the FOP distribution (version 0.20.4), it works fine and clips as expected -
> varying the clipPath's width will show more or less text accordingly.
> However, when I pass the FOP-XML to my processor (a servlet) I get the
> NullPointerException shown after the XML.  It seems to be caused by the url
> not being found but I am at a loss as how to tell the processor that I want
> to refer to the document itself.  Is there a configuration parameter that
> needs to be set?  Is there another way to pass in the reference to the
> clipPath?
> 
> Note that I have tried replacing the clip-path attribute with both of the
> following which, although they avoid the error, fail to clip the text.
> 
> clip-path:#xpointer(#4203)
> clip-path:#xpointer(id(4203))
<snip/>

Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org