You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by mlatorre <ml...@iritec.es> on 2006/03/24 13:19:32 UTC

problem when transcoding a flowroot element

Hi, we're using batik 1.6 in a web application (JSP). Everything worked fine
until now. Now, we're trying to render a <flowRoot> element (specified in
SVG 1.2 draft). A very simple SVG document example is attached
(plantillaFlow.svg).

We parse the document with:

       String parser = XMLResourceDescriptor.getXMLParserClassName();
       SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parser);
       Document doc = f.createDocument(svgURI);

And then we try to transcode to .jpg:

       TranscoderInput input=new TranscoderInput(doc);

       JPEGTranscoder  trans = new JPEGTranscoder();
       trans.addTranscodingHint(JPEGTranscoder.KEY_QUALITY,new Float(1.0));
       trans.addTranscodingHint(JPEGTranscoder.KEY_WIDTH,new Float(par[0]));
       trans.addTranscodingHint(JPEGTranscoder.KEY_HEIGHT,new
Float(par[1]));
		
       OutputStream ostream = new FileOutputStream(outputFilename);
       TranscoderOutput output = new TranscoderOutput(ostream);

       trans.transcode(input, output);

But the transcode method fails with an exception:

-------------------------------------

java.lang.NullPointerException
	
org.apache.batik.bridge.svg12.SVGFlowRootElementBridge.getRegions(Unknown
Source)
	
org.apache.batik.bridge.svg12.SVGFlowRootElementBridge.buildAttributedString
(Unknown Source)
	
org.apache.batik.bridge.SVGTextElementBridge.computeLaidoutText(Unknown
Source)
	
org.apache.batik.bridge.svg12.SVGFlowRootElementBridge.computeLaidoutText(Un
known Source)
	
org.apache.batik.bridge.SVGTextElementBridge.buildGraphicsNode(Unknown
Source)
	org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(Unknown Source)
	org.apache.batik.bridge.GVTBuilder.buildComposite(Unknown Source)
	org.apache.batik.bridge.GVTBuilder.build(Unknown Source)
	org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(Unknown
Source)
	org.apache.batik.transcoder.image.ImageTranscoder.transcode(Unknown
Source)
	org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(Unknown
Source)
	org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(Unknown
Source)
	zonaprint.imagen.genera_miniaturaJPG(imagen.java:355)
	
org.apache.jsp.productos.miniatura_005fplantilla_jsp._jspService(miniatura_0
05fplantilla_jsp.java:73)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:3
32)
	
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

-------------------------------------

Why is this happening? Is this a known bug, or is rootFlow not yet
implemented?

Any help World be appreciated.

Thanks very much.

========================

Marcos LaTorre <ml...@iritec.es>

RE: problem when transcoding a flowroot element

Posted by th...@kodak.com.
Hi Marcos,

"mlatorre" <ml...@iritec.es> wrote on 03/28/2006 06:01:11 AM:

> You are right, there's no flowDiv around the flowPara element.

> This was created with Inkscape. Is the flowDiv element mandatory? If so, 
it
> looks like Inkscape is saving a wrong SVG file.
> 
> I checked the SVG 1.2 draft at 
> 
> http://www.w3.org/TR/2004/WD-SVG12-20041027/flow.html
> 
> And I couldn't find anything about this. Even the example is wrong.

   *Sigh* It looks like they made it optional and allowed multiple
copies.  I'm not entirely sure what the intent is there as far as 
Block layout is concerned (they talk briefly about being 'offset'
but I'm not sure if that is just talking about the collapsing boarder
model or not).

   Anyway, with the current Mobile drafts they have (quite unfortunately)
gone an entirely different (less capable) way so I don't plan to put any 
effort into 'fixing' this since aligning with the draft would be almost 
pointless since every indication is that this will change the next time 
the WG gets around to publishing a full SVG spec (if ever).

   I hope it's not too much trouble/work to add a flowDiv around
the content for rendering in Batik.  It might be possible to
modify the Batik source to work around the missing Div as well.

> "mlatorre" <ml...@iritec.es> wrote on 03/28/2006 04:01:39 AM:
> 
> > I've downloaded and built the SVN version, and I'm still getting the 
> same
> > problem:
> > 
> > java.lang.NullPointerException at
> > org.apache.batik.bridge.svg12.SVGFlowRootElementBridge.getRegions
> 
>     Well, can you provide a small example that shows the problem?
> 
> > So it looks the problem is not fixed. I'll try to check the source and 

> try
> > to find the problem, but I don't know if I'll be able to fix it. Any 
> other
> > ideas?
> 
>     Is your flowRoot element missing the flowDiv element around 
> the flowPara elements?
> 
> > -----Mensaje original-----
> > De: thomas.deweese@kodak.com [mailto:thomas.deweese@kodak.com] 
> > Enviado el: viernes, 24 de marzo de 2006 13:42
> > Para: batik-users@xmlgraphics.apache.org
> > CC: batik-users@xmlgraphics.apache.org
> > Asunto: Re: problem when transcoding a flowroot element
> > 
> > Hi Marcos,
> > 
> > "mlatorre" <ml...@iritec.es> wrote on 03/24/2006 07:19:32 AM:
> > 
> > > Hi, we're using batik 1.6 in a web application (JSP). Everything 
> worked
> > fine
> > > until now. Now, we're trying to render a <flowRoot> element 
(specified 
> 
> > in
> > > SVG 1.2 draft). A very simple SVG document example is attached
> > > (plantillaFlow.svg).
> > 
> > > But the transcode method fails with an exception:
> > 
> > > java.lang.NullPointerException
> > > 
> > 
> 
org.apache.batik.bridge.svg12.SVGFlowRootElementBridge.getRegions(Unknown
> > > Source)
> > 
> > > Why is this happening? Is this a known bug, or is rootFlow not yet
> > > implemented?
> > 
> >    This looks like a bug in the FlowRoot Implementation that was fixed
> > recently (r371909).  I would suggest getting the SVN version of Batik 
> > and trying that.
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> > For additional commands, e-mail: 
batik-users-help@xmlgraphics.apache.org
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> > For additional commands, e-mail: 
batik-users-help@xmlgraphics.apache.org
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


RE: problem when transcoding a flowroot element

Posted by mlatorre <ml...@iritec.es>.
You are right, there's no flowDiv around the flowPara element. This is the
SVG XML:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
   xmlns:svg="http://www.w3.org/2000/svg"
   xmlns="http://www.w3.org/2000/svg"
   version="1.2"
   width="210mm"
   height="297mm"
   id="svg2216">
  <defs
     id="defs2219" />
  <flowRoot
     id="flowRoot2231"
     xml:space="preserve"><flowRegion
       id="flowRegion2233"><rect
         width="375.23907"
         height="234.17175"
         x="118.49654"
         y="203.13693"
         id="rect2235" /></flowRegion><flowPara
       id="flowPara2237">Hello World</flowPara></flowRoot></svg>

This was created with Inkscape. Is the flowDiv element mandatory? If so, it
looks like Inkscape is saving a wrong SVG file.

I checked the SVG 1.2 draft at 

http://www.w3.org/TR/2004/WD-SVG12-20041027/flow.html

And I couldn't find anything about this. Even the example is wrong.

Thanks very much.

-----Mensaje original-----
De: thomas.deweese@kodak.com [mailto:thomas.deweese@kodak.com] 
Enviado el: martes, 28 de marzo de 2006 12:40
Para: batik-users@xmlgraphics.apache.org
CC: batik-users@xmlgraphics.apache.org
Asunto: RE: problem when transcoding a flowroot element

Hi Marcos,

"mlatorre" <ml...@iritec.es> wrote on 03/28/2006 04:01:39 AM:

> I've downloaded and built the SVN version, and I'm still getting the 
same
> problem:
> 
> java.lang.NullPointerException at
> org.apache.batik.bridge.svg12.SVGFlowRootElementBridge.getRegions

    Well, can you provide a small example that shows the problem?

> So it looks the problem is not fixed. I'll try to check the source and 
try
> to find the problem, but I don't know if I'll be able to fix it. Any 
other
> ideas?

    Is your flowRoot element missing the flowDiv element around 
the flowPara elements?

> -----Mensaje original-----
> De: thomas.deweese@kodak.com [mailto:thomas.deweese@kodak.com] 
> Enviado el: viernes, 24 de marzo de 2006 13:42
> Para: batik-users@xmlgraphics.apache.org
> CC: batik-users@xmlgraphics.apache.org
> Asunto: Re: problem when transcoding a flowroot element
> 
> Hi Marcos,
> 
> "mlatorre" <ml...@iritec.es> wrote on 03/24/2006 07:19:32 AM:
> 
> > Hi, we're using batik 1.6 in a web application (JSP). Everything 
worked
> fine
> > until now. Now, we're trying to render a <flowRoot> element (specified 

> in
> > SVG 1.2 draft). A very simple SVG document example is attached
> > (plantillaFlow.svg).
> 
> > But the transcode method fails with an exception:
> 
> > java.lang.NullPointerException
> > 
> 
org.apache.batik.bridge.svg12.SVGFlowRootElementBridge.getRegions(Unknown
> > Source)
> 
> > Why is this happening? Is this a known bug, or is rootFlow not yet
> > implemented?
> 
>    This looks like a bug in the FlowRoot Implementation that was fixed
> recently (r371909).  I would suggest getting the SVN version of Batik 
> and trying that.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


RE: problem when transcoding a flowroot element

Posted by th...@kodak.com.
Hi Marcos,

"mlatorre" <ml...@iritec.es> wrote on 03/28/2006 04:01:39 AM:

> I've downloaded and built the SVN version, and I'm still getting the 
same
> problem:
> 
> java.lang.NullPointerException at
> org.apache.batik.bridge.svg12.SVGFlowRootElementBridge.getRegions

    Well, can you provide a small example that shows the problem?

> So it looks the problem is not fixed. I'll try to check the source and 
try
> to find the problem, but I don't know if I'll be able to fix it. Any 
other
> ideas?

    Is your flowRoot element missing the flowDiv element around 
the flowPara elements?

> -----Mensaje original-----
> De: thomas.deweese@kodak.com [mailto:thomas.deweese@kodak.com] 
> Enviado el: viernes, 24 de marzo de 2006 13:42
> Para: batik-users@xmlgraphics.apache.org
> CC: batik-users@xmlgraphics.apache.org
> Asunto: Re: problem when transcoding a flowroot element
> 
> Hi Marcos,
> 
> "mlatorre" <ml...@iritec.es> wrote on 03/24/2006 07:19:32 AM:
> 
> > Hi, we're using batik 1.6 in a web application (JSP). Everything 
worked
> fine
> > until now. Now, we're trying to render a <flowRoot> element (specified 

> in
> > SVG 1.2 draft). A very simple SVG document example is attached
> > (plantillaFlow.svg).
> 
> > But the transcode method fails with an exception:
> 
> > java.lang.NullPointerException
> > 
> 
org.apache.batik.bridge.svg12.SVGFlowRootElementBridge.getRegions(Unknown
> > Source)
> 
> > Why is this happening? Is this a known bug, or is rootFlow not yet
> > implemented?
> 
>    This looks like a bug in the FlowRoot Implementation that was fixed
> recently (r371909).  I would suggest getting the SVN version of Batik 
> and trying that.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


RE: problem when transcoding a flowroot element

Posted by mlatorre <ml...@iritec.es>.
Hi Thomas,

I've downloaded and built the SVN version, and I'm still getting the same
problem:


java.lang.NullPointerException
	at
org.apache.batik.bridge.svg12.SVGFlowRootElementBridge.getRegions(Unknown
Source)
	at
org.apache.batik.bridge.svg12.SVGFlowRootElementBridge.buildAttributedString
(Unknown Source)
	at
org.apache.batik.bridge.SVGTextElementBridge.computeLaidoutText(Unknown
Source)
	at
org.apache.batik.bridge.svg12.SVGFlowRootElementBridge.computeLaidoutText(Un
known Source)
	at
org.apache.batik.bridge.SVGTextElementBridge.buildGraphicsNode(Unknown
Source)
	at
org.apache.batik.bridge.svg12.SVGFlowRootElementBridge.buildGraphicsNode(Unk
nown Source)
	at org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(Unknown
Source)
	at org.apache.batik.bridge.GVTBuilder.buildComposite(Unknown Source)
	at org.apache.batik.bridge.GVTBuilder.build(Unknown Source)
	at
org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(Unknown Source)
	at
org.apache.batik.transcoder.image.ImageTranscoder.transcode(Unknown Source)
	at
org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(Unknown Source)
	at
org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(Unknown Source)
	at zonaprint.imagen.genera_miniaturaJPG(imagen.java:355)
	at
org.apache.jsp.productos.miniatura_005fplantilla_jsp._jspService(miniatura_0
05fplantilla_jsp.java:73)
	at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:3
32)
	at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:252)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:173)
	at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:213)
	at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:178)
	at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126
)
	at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105
)
	at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:107)
	at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
	at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
	at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processC
onnection(Http11BaseProtocol.java:667)
	at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.jav
a:527)
	at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWo
rkerThread.java:80)
	at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav
a:684)
	at java.lang.Thread.run(Unknown Source)


So it looks the problem is not fixed. I'll try to check the source and try
to find the problem, but I don't know if I'll be able to fix it. Any other
ideas?

Thanks very much.

-----Mensaje original-----
De: thomas.deweese@kodak.com [mailto:thomas.deweese@kodak.com] 
Enviado el: viernes, 24 de marzo de 2006 13:42
Para: batik-users@xmlgraphics.apache.org
CC: batik-users@xmlgraphics.apache.org
Asunto: Re: problem when transcoding a flowroot element

Hi Marcos,

"mlatorre" <ml...@iritec.es> wrote on 03/24/2006 07:19:32 AM:

> Hi, we're using batik 1.6 in a web application (JSP). Everything worked
fine
> until now. Now, we're trying to render a <flowRoot> element (specified 
in
> SVG 1.2 draft). A very simple SVG document example is attached
> (plantillaFlow.svg).

> But the transcode method fails with an exception:

> java.lang.NullPointerException
> 
org.apache.batik.bridge.svg12.SVGFlowRootElementBridge.getRegions(Unknown
> Source)

> Why is this happening? Is this a known bug, or is rootFlow not yet
> implemented?

   This looks like a bug in the FlowRoot Implementation that was fixed
recently (r371909).  I would suggest getting the SVN version of Batik 
and trying that.


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: problem when transcoding a flowroot element

Posted by th...@kodak.com.
Hi Marcos,

"mlatorre" <ml...@iritec.es> wrote on 03/24/2006 07:19:32 AM:

> Hi, we're using batik 1.6 in a web application (JSP). Everything worked 
fine
> until now. Now, we're trying to render a <flowRoot> element (specified 
in
> SVG 1.2 draft). A very simple SVG document example is attached
> (plantillaFlow.svg).

> But the transcode method fails with an exception:

> java.lang.NullPointerException
> 
org.apache.batik.bridge.svg12.SVGFlowRootElementBridge.getRegions(Unknown
> Source)

> Why is this happening? Is this a known bug, or is rootFlow not yet
> implemented?

   This looks like a bug in the FlowRoot Implementation that was fixed
recently (r371909).  I would suggest getting the SVN version of Batik 
and trying that.


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org