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 Swapan Golla <sg...@yahoo.com> on 2003/03/04 18:11:50 UTC

TextFlow

I am trying to transform the flowText.svg given in the
samples/extensions directory and transforming into pdf
and it is producing me a pdf without any text. Is
there anything that I should do specially to
incorporate the text wrapping stuff into my pdf ?

Swapan.

__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/

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


Re: TextFlow

Posted by Swapan Golla <sg...@yahoo.com>.
I created BatikElementMapping and BatikObj objects and
added this entry in the driver class. I am getting the
following exception. Can anybody help ?

Swapan.

[INFO] Using org.apache.xerces.parsers.SAXParser as
SAX2 Parser
[INFO] FOP 0.20.5rc2
[INFO] Using org.apache.xerces.parsers.SAXParser as
SAX2 Parser
[INFO] building formatting object tree
[INFO] setting up fonts
[INFO] [1]
[ERROR] svg graphic could not be built: null
java.lang.ClassCastException
        at
org.apache.batik.bridge.CSSUtilities.getComputedStyle(CSSUtilities.java:96)
        at
org.apache.batik.bridge.CSSUtilities.convertDisplay(CSSUtilities.java:509)
        at
org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(GVTBuilder.java:176)
        at
org.apache.batik.bridge.GVTBuilder.buildComposite(GVTBuilder.java:148)
        at
org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(GVTBuilder.java:188)
        at
org.apache.batik.bridge.GVTBuilder.buildComposite(GVTBuilder.java:148)
        at
org.apache.batik.bridge.GVTBuilder.build(GVTBuilder.java:76)
        at
org.apache.fop.render.pdf.PDFRenderer.renderSVGDocument(PDFRenderer.java:513)
        at
org.apache.fop.render.pdf.PDFRenderer.renderSVGArea(PDFRenderer.java:472)
        at
org.apache.fop.svg.SVGArea.render(SVGArea.java:58)
        at
org.apache.fop.render.pdf.PDFRenderer.renderForeignObjectArea(PDFRenderer.java:456)
        at
org.apache.fop.layout.inline.ForeignObjectArea.render(ForeignObjectArea.java:46)
        at
org.apache.fop.render.AbstractRenderer.renderAreaContainer(AbstractRenderer.java:408)
        at
org.apache.fop.layout.ColumnArea.render(ColumnArea.java:29)
        at
org.apache.fop.render.AbstractRenderer.renderSpanArea(AbstractRenderer.java:57)
        at
org.apache.fop.layout.SpanArea.render(SpanArea.java:52)
        at
org.apache.fop.render.AbstractRenderer.renderBodyAreaContainer(AbstractRenderer.java:325)
        at
org.apache.fop.layout.BodyAreaContainer.render(BodyAreaContainer.java:98)
        at
org.apache.fop.render.AbstractRenderer.renderRegions(AbstractRenderer.java:494)
        at
org.apache.fop.render.pdf.PDFRenderer.renderPage(PDFRenderer.java:837)
        at
org.apache.fop.render.pdf.PDFRenderer.render(PDFRenderer.java:813)
        at
org.apache.fop.apps.StreamRenderer.queuePage(StreamRenderer.java:258)
        at
org.apache.fop.layout.AreaTree.addPage(AreaTree.java:68)
        at
org.apache.fop.fo.pagination.PageSequence.makePage(PageSequence.java:359)
        at
org.apache.fop.fo.pagination.PageSequence.format(PageSequence.java:290)
        at
org.apache.fop.apps.StreamRenderer.render(StreamRenderer.java:218)
        at
org.apache.fop.fo.FOTreeBuilder.endElement(FOTreeBuilder.java:177)
        at
org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown
Source)
        at
org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown
Source)
        at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
So
urce)
        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:459)
        at
org.apache.fop.apps.CommandLineStarter.run(CommandLineStarter.java:69)
        at org.apache.fop.apps.Fop.main(Fop.java:19)
[INFO] Parsing of document complete, stopping renderer





--- "J.Pietschmann" <j3...@yahoo.de> wrote:
> Swapan Golla wrote:
> > Well, I have looked through the Driver and
> > SVGElementMapping classes and concluded that in
> order
> > to create batik extension support in FOP, I need
> to
> > create similiar classes of SVGElementMapping,
> SVGObj
> > and SVGElement in the FOP src and then register
> them
> > with the FOP driver class. Are these conclusions
> valid
> 
> I think you need only an element mapping class, you
> can probably
> reuse SVGObj/SVGElement.
> 
> > and also, are there any changes I need to do in
> batik
> > src ?
> I don't think so. IIRC the SVGElement temporarily
> holds a SVG
> element node, and a proper stylable DOM is generated
> from them
> further down the stream.
> 
> J.Pietschmann
> 
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail:
> batik-users-help@xml.apache.org
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/

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


Re: TextFlow

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Swapan Golla wrote:
> Well, I have looked through the Driver and
> SVGElementMapping classes and concluded that in order
> to create batik extension support in FOP, I need to
> create similiar classes of SVGElementMapping, SVGObj
> and SVGElement in the FOP src and then register them
> with the FOP driver class. Are these conclusions valid

I think you need only an element mapping class, you can probably
reuse SVGObj/SVGElement.

> and also, are there any changes I need to do in batik
> src ?
I don't think so. IIRC the SVGElement temporarily holds a SVG
element node, and a proper stylable DOM is generated from them
further down the stream.

J.Pietschmann




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


Re: TextFlow

Posted by Swapan Golla <sg...@yahoo.com>.
Well, I have looked through the Driver and
SVGElementMapping classes and concluded that in order
to create batik extension support in FOP, I need to
create similiar classes of SVGElementMapping, SVGObj
and SVGElement in the FOP src and then register them
with the FOP driver class. Are these conclusions valid
and also, are there any changes I need to do in batik
src ?

Swapan.

--- "J.Pietschmann" <j3...@yahoo.de> wrote:
> Swapan Golla wrote:
> > I did put the batik-extension.jar,
> batik-svg-dom.jar
> > in the classpath and then tried to convert into
> pdf.
> > If I externally reference the svg file, everything
> > works fine but if I embed the svg file in my fo
> > document, it produces a blank pdf with the
> following
> > errors:
> > 
> > Unknown Formatting Object
> > http://xml.apache.org/batik/ext^flowText
> ...
> > How can the same svg work well when externally
> > referenced but not work when embedded in an fo
> > document? Can anybody help ? 
> 
> The DOM for instream-foreign-objects is built by
> FOP. The
> current code uses an explicit mapping to a maker
> class for
> this. You'll have to provide an element mapping
> class as
> well as a maker class for any extension elements.
> The
> mapping class can be registered as a service as well
> as
> explicitely supplied to the Driver. Look into the
> source
> fo rthe Driver and the SVGElementMapping for hints
> and
> examples.
> 
> J.Pietschmann
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail:
> batik-users-help@xml.apache.org
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/

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


Re: TextFlow

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Swapan Golla wrote:
> I did put the batik-extension.jar, batik-svg-dom.jar
> in the classpath and then tried to convert into pdf.
> If I externally reference the svg file, everything
> works fine but if I embed the svg file in my fo
> document, it produces a blank pdf with the following
> errors:
> 
> Unknown Formatting Object
> http://xml.apache.org/batik/ext^flowText
...
> How can the same svg work well when externally
> referenced but not work when embedded in an fo
> document? Can anybody help ? 

The DOM for instream-foreign-objects is built by FOP. The
current code uses an explicit mapping to a maker class for
this. You'll have to provide an element mapping class as
well as a maker class for any extension elements. The
mapping class can be registered as a service as well as
explicitely supplied to the Driver. Look into the source
fo rthe Driver and the SVGElementMapping for hints and
examples.

J.Pietschmann


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


RE: TextFlow

Posted by Swapan Golla <sg...@yahoo.com>.
I did put the batik-extension.jar, batik-svg-dom.jar
in the classpath and then tried to convert into pdf.
If I externally reference the svg file, everything
works fine but if I embed the svg file in my fo
document, it produces a blank pdf with the following
errors:

Unknown Formatting Object
http://xml.apache.org/batik/ext^flowText
Unknown Formatting Object
http://xml.apache.org/batik/ext^flowRegion
Unknown Formatting Object
http://xml.apache.org/batik/ext^region

and so on.

How can the same svg work well when externally
referenced but not work when embedded in an fo
document? Can anybody help ? 

Swapan.

// FO DOCUMENT 



<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:html="http://doctype.gallup.com/g/namespace/html"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:fox="http://xml.apache.org/fop/extensions" >			
	<fo:layout-master-set>				
		<fo:simple-page-master master-name="individual_page"
page-height="29.7cm"
				page-width="21cm" margin-top="2.0cm"
margin-bottom="2.0cm"
				margin-left="2.5cm" margin-right="2.5cm">					
			<fo:region-body margin-top="0.5cm"
margin-bottom="0.5cm"/>					
			<fo:region-before extent="0.5cm"/>					
			<fo:region-after extent="0.5cm"/>				
		</fo:simple-page-master>				
	</fo:layout-master-set>
	
	<fo:page-sequence master-reference="individual_page">
		<fo:flow flow-name="xsl-region-body"
break-after="page" >

		<fo:instream-foreign-object>
					<svg:svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:batik="http://xml.apache.org/batik/ext"
id="body" width="450" height="500" viewBox="0 0 450
500">
					<svg:title>Test of Text wrapping
stuff.</svg:title>
							<svg:g id="content" >
					
					      <svg:text class="title" x="50%" y="40">Test
of Text wrapping stuff</svg:text>
					         <!-- Space after size 40 'that' is aci
45 -->
					      <svg:rect x="17"  y="80" width="200"
height="400" fill="rgb(220,220,255)"/>
					      <svg:rect x="233" y="80" width="200"
height="400" fill="rgb(220,220,255)"/>
					
					      <svg:line x1="27"  y1="70" x2="27" 
y2="490" stroke="grey" fill="none"/>
					      <svg:line x1="207" y1="70" x2="207"
y2="490" stroke="grey" fill="none"/>
					      <svg:line x1="243" y1="70" x2="243"
y2="490" stroke="grey" fill="none"/>
					      <svg:line x1="423" y1="70" x2="423"
y2="490" stroke="grey" fill="none"/>
					
					      <batik:flowText
xmlns:batik="http://xml.apache.org/batik/ext"
						            font-size="20" xml:space="preserve">
						<batik:flowRegion>
						    <batik:region x="17"  y="80" width="200"
height="400"/>
						    <batik:region x="233" y="80" width="200"
height="400"/>
						</batik:flowRegion>
						
						
						<batik:flowDiv>
						    <batik:flowPara first-line-left-margin="20"
bottom-margin="10" >This is an <batik:flowSpan
font-size="40"
fill="crimson">ex&#x00AD;ample</batik:flowSpan> of a
very long string that is split &#x200D;across
multi&#x00AD;ple lines via text
wrap&#x0AD;ping.</batik:flowPara>
						    <batik:flowPara justification="middle"
top-margin="10" left-margin="10" right-margin="10"
bottom-margin="10"><batik:flowLine>Now check if text
wrapping handles a number of tricky</batik:flowLine>
situations:
averylongrunonwordthatspansmultiplelines<batik:flowSpan
font-weight="bold">with<batik:flowSpan
fill="crimson">embedded</batik:flowSpan>span</batik:flowSpan>elements
&amp; <batik:flowSpan fill="green" dy="-.3em"
font-size="80%">super</batik:flowSpan><batik:flowSpan
dy=".3em"> or </batik:flowSpan><batik:flowSpan
fill="darkgreen" dy=".3em"
font-size="80%">sub</batik:flowSpan><batik:flowSpan
dy="-.3em"> scripts.</batik:flowSpan></batik:flowPara>
						    <batik:flowPara top-margin="10"
justification="end">Now we are just <batik:flowSpan
font-size="30" fill="blue">about</batik:flowSpan> to
go to the next flow rect <batik:flowSpan
font-size="10">(note if the 'about' were included on
the last line of the previous flow rect the line would
not have fit and the whole line would have moved
here).</batik:flowSpan></batik:flowPara>
						    <batik:flowPara margin="10"
justification="full">     I'll keep going because I
want to make sure that it properly stops when it hits
the end of all of the the flow regions defined. Also
the last line includes text in a larger font size so
it will not fit. Thus the end of this sentence will be
cut off because the line size gets <batik:flowSpan
font-size="35">tall</batik:flowSpan>er</batik:flowPara>
						</batik:flowDiv>
					
						
					      </batik:flowText>
					   </svg:g>	
					
					</svg:svg>
		</fo:instream-foreign-object>


		</fo:flow>
	</fo:page-sequence>
</fo:root>






--- Thomas E Deweese <th...@kodak.com> wrote:
> >>>>> "SG" == Swapan Golla <sg...@yahoo.com>
> writes:
> 
> SG> I am trying to transform the flowText.svg given
> in the
> SG> samples/extensions directory and transforming
> into pdf and it is
> SG> producing me a pdf without any text. Is there
> anything that I
> SG> should do specially to incorporate the text
> wrapping stuff into my
> SG> pdf ?
> 
>     I've never tried to do this, however I am
> surprised at this result
> since from the pdf converters point of view the
> flowText is
> indistinguishable from other SVG text.
> 
>     Can you view your SVG in the browser?
> 
>     Are you including the extensions on your
> classpath?  Normally we
> do not include the extensions in the class path for
> our tools since
> they are not conformant SVG (at least not yet).
> 
>     All of which get's to how are you invoking the
> pdf transcoder?
> 
> SG> Swapan.
> 
> SG>
> __________________________________________________
> Do you Yahoo!?
> SG> Yahoo! Tax Center - forms, calculators, tips,
> more
> SG> http://taxes.yahoo.com/
> 
> SG>
>
---------------------------------------------------------------------
> SG> To unsubscribe, e-mail:
> batik-users-unsubscribe@xml.apache.org For
> SG> additional commands, e-mail:
> batik-users-help@xml.apache.org
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail:
> batik-users-help@xml.apache.org
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/

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


RE: TextFlow

Posted by Thomas E Deweese <th...@kodak.com>.
>>>>> "SG" == Swapan Golla <sg...@yahoo.com> writes:

SG> I am trying to transform the flowText.svg given in the
SG> samples/extensions directory and transforming into pdf and it is
SG> producing me a pdf without any text. Is there anything that I
SG> should do specially to incorporate the text wrapping stuff into my
SG> pdf ?

    I've never tried to do this, however I am surprised at this result
since from the pdf converters point of view the flowText is
indistinguishable from other SVG text.

    Can you view your SVG in the browser?

    Are you including the extensions on your classpath?  Normally we
do not include the extensions in the class path for our tools since
they are not conformant SVG (at least not yet).

    All of which get's to how are you invoking the pdf transcoder?

SG> Swapan.

SG> __________________________________________________ Do you Yahoo!?
SG> Yahoo! Tax Center - forms, calculators, tips, more
SG> http://taxes.yahoo.com/

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



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