You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Joerg Heinicke <jo...@gmx.de> on 2003/03/11 17:21:27 UTC
FOP, inline SVG, fonts
Hello Cocooners,
I have some problems with Cocoon 2.0.3 or 2.0.4, Fop 0.20.3 or 0.20.4,
inline SVG (because using cocoon:// protocol does not work in general) and
fonts.
Using Cocoon 2.0.3 with Fop 0.20.3 my PDFs look really nice according to
fonts. But I can not include SVGs using fo:instream-foreign-object:
java.lang.NoClassDefFoundError: org/apache/batik/dom/svg/DefaultSVGContext.
This class does not exist in batik-all-1.5b2.jar used in Cocoon, but the
reason can't be the Batik jar, because it works in Cocoon 2.0.4 with the
same jar.
On the other hand the fonts only work in 2.0.3. They are configured in
Cocoon's sitemap:
<map:serializer name="pdf" mime-type="application/pdf"
src="org.apache.cocoon.serialization.FOPSerializer">
<user-config src="webapps/ROOT/doc/fop/config.xml"/>
</map:serializer>
and the user-config looks like
<configuration>
<fonts>
<font metrics-file="webapps/ROOT/doc/fop/fonts/Verdana.xml" kerning="yes"
embed-file="webapps/ROOT/doc/fop/fonts/Verdana.ttf">
<font-triplet name="Verdana" style="normal" weight="normal"/>
</font>
<font metrics-file="webapps/ROOT/doc/fop/fonts/Verdanab.xml" kerning="yes"
embed-file="webapps/ROOT/doc/fop/fonts/Verdanab.ttf">
<font-triplet name="Verdana" style="normal" weight="bold"/>
</font>
<font metrics-file="webapps/ROOT/doc/fop/fonts/Verdanai.xml" kerning="yes"
embed-file="webapps/ROOT/doc/fop/fonts/Verdanai.ttf">
<font-triplet name="Verdana" style="italic" weight="normal"/>
</font>
<font metrics-file="webapps/ROOT/doc/fop/fonts/Verdanaz.xml" kerning="yes"
embed-file="webapps/ROOT/doc/fop/fonts/Verdanaz.ttf">
<font-triplet name="Verdana" style="italic" weight="bold"/>
</font>
</fonts>
</configuration>
They work *despite* bug 6533
(http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6533) and Vadim's fix,
which was - according to CVS commit messages - applied after Cocoon 2.0.3
release
(http://cvs.apache.org/viewcvs.cgi/cocoon-2-historical/src/java/org/apache/cocoon/serialization/Attic/FOPSerializer.java?only_with_tag=cocoon_2_0_3_branch).
The same does not work in Cocoon 2.0.4. I get an NullPointerException,
because _something_ is null. The config file is loaded correctly, but
something goes wrong with the font files:
2003-03-11 16:04:00,896 INFO [org.jboss.web.localhost.Engine] ERROR
(2003-03-11) 16:04.00:896 [manager.] (/conweb/stream.secure.pdf)
Thread-8/MessageHandler: Failed to read font metrics file
nullwebapps/ROOT/doc/fop/fonts/Verdana.xml :
/home/jheinicke/development/IUPB/iupb/nullwebapps/ROOT/doc/fop/fonts/Verdana.xml
(see the both 'null' above)
beginning of stacktrace:
javax.xml.transform.TransformerException: java.lang.NullPointerException
at
org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.java:1226)
at
org.apache.xalan.transformer.TransformerImpl.run(TransformerImpl.java:3135)
at java.lang.Thread.run(Thread.java:536)
Caused by: java.lang.NullPointerException
at org.apache.fop.render.pdf.fonts.LazyFont.getAscender(Unknown Source)
at org.apache.fop.layout.FontState.getAscender(Unknown Source)
So what should I do? Should I abstain from using fonts or from using
dynamically generated images? I want both :-) Or is it in current CVS
version possible to use the cocoon:// protocol, which would be the most
prefered solution.
Has anyone solved a similar problem?
Regards,
Joerg
--
System Development
VIRBUS AG
Fon +49(0)341-979-7419
Fax +49(0)341-979-7409
joerg.heinicke@virbus.de
www.virbus.de
CeBIT 2003 vom 12. bis zum 19. März in Hannover
VIRBUS stellt gemeinsam mit der IBM-Tochter IT-Services and Solutions
GmbH aus.
Lassen Sie sich überraschen von den neuen, umfassenden Möglichkeiten im
Internet-gestützten Zahlungsverkehr.
Besuchen Sie uns: Halle 3, Stand D55.
---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org
Re: FOP, inline SVG, fonts
Posted by Joerg Heinicke <jo...@gmx.de>.
> But I got excalibur source resolving to work in *a* way with Cocoon 2.1
> or better said with excalibur-sourceresolve-20030130.jar. I don't know
> how good or bad it is. Interests?
Carsten already did it today morning.
Joerg
--
System Development
VIRBUS AG
Fon +49(0)341-979-7419
Fax +49(0)341-979-7409
joerg.heinicke@virbus.de
www.virbus.de
CeBIT 2003 vom 12. bis zum 19. März in Hannover
VIRBUS stellt gemeinsam mit der IBM-Tochter IT-Services and Solutions
GmbH aus.
Lassen Sie sich überraschen von den neuen, umfassenden Möglichkeiten im
Internet-gestützten Zahlungsverkehr.
Besuchen Sie uns: Halle 3, Stand D55.
---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org
Re: FOP, inline SVG, fonts
Posted by Vadim Gritsenko <va...@verizon.net>.
Joerg Heinicke wrote:
>>> Why must it be absolute paths now? In Cocoon 2.0.3 with Fop 0.20.3
>>> the relative paths worked without any problems. But no longer in
>>> Cocoon 2.0.4 with Fop 0.20.4?
>>
>>
>>
>> Not that it *must*... Yes it should work with relative path. But
>> these paths will be relative to the current working directory of JVM
>> - not relative to webapp context or sitemap. Because of this, it is
>> easier to say that paths to the fonts must be absolute paths.
>
>
>
> Hmm, maybe because we use JBoss + Tomcat + Cocoon. Do you know what
> changed between Fop 0.20.3 and 0.20.4, that prevents my old stuff from
> working? Or is it deep Fop interna?
No, I don't know what has been changed.
Vadim
---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org
Re: FOP, inline SVG, fonts
Posted by "J.Pietschmann" <j3...@yahoo.de>.
Joerg Heinicke wrote:
> Hmm, maybe because we use JBoss + Tomcat + Cocoon. Do you know what
> changed between Fop 0.20.3 and 0.20.4, that prevents my old stuff from
> working? Or is it deep Fop interna?
There were two changes: the switch from using Xerces native to JAXP
for creating the XML parser for reading the config file and feeding
the metrics-file name directly to the InputSource constructor instead
of creating a File first (which means it is interpreted as URL rather
than as filename, making Windows path names like "C:\foo" problematic).
The new 0.20.5 release has some improvements, in particular you can
supply a baseURL for images and a fontBaseURL for font related files.
Documentation may be a bit sparse, you might have to blackmail Jeremias
to get it :-)
If you (or anybody else) are interested into looking at ideas for the
FOP API redesign, look at
http://nagoya.apache.org/wiki/apachewiki.cgi?FOPAvalonization
Also, it's a Wiki, you *can* edit it to bring in your ideas.
J.Pietschmann
---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org
Re: FOP, inline SVG, fonts
Posted by Joerg Heinicke <jo...@gmx.de>.
>> Why must it be absolute paths now? In Cocoon 2.0.3 with Fop 0.20.3 the
>> relative paths worked without any problems. But no longer in Cocoon
>> 2.0.4 with Fop 0.20.4?
>
>
> Not that it *must*... Yes it should work with relative path. But these
> paths will be relative to the current working directory of JVM - not
> relative to webapp context or sitemap. Because of this, it is easier to
> say that paths to the fonts must be absolute paths.
Hmm, maybe because we use JBoss + Tomcat + Cocoon. Do you know what changed
between Fop 0.20.3 and 0.20.4, that prevents my old stuff from working? Or
is it deep Fop interna?
Joerg
--
System Development
VIRBUS AG
Fon +49(0)341-979-7419
Fax +49(0)341-979-7409
joerg.heinicke@virbus.de
www.virbus.de
CeBIT 2003 vom 12. bis zum 19. März in Hannover
VIRBUS stellt gemeinsam mit der IBM-Tochter IT-Services and Solutions
GmbH aus.
Lassen Sie sich überraschen von den neuen, umfassenden Möglichkeiten im
Internet-gestützten Zahlungsverkehr.
Besuchen Sie uns: Halle 3, Stand D55.
---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org
Re: FOP, inline SVG, fonts
Posted by Vadim Gritsenko <va...@verizon.net>.
Joerg Heinicke wrote:
> Hello Vadim,
>
>
> Vadim Gritsenko wrote:
> > Frank made a mistake... New configuration syntax which supports Cocoon
> > protocols looks like:
> >
> > <user-config>context://webapps/ROOT/doc/fop/config.xml</user-config>
> >
> > Old configuration (with src attribute) does not support protocols,
> works
> > only with file name (see FOPSerializer.java).
>
>
> I tested the new configuration of the pdf serializer, but no luck. The
> userconfig file is found as before (but yeah, I use the new
> configuration ;-), but there is still a null in the path to the fonts:
>
> Failed to read font metrics file
> nullwebapps/ROOT/doc/fop/fonts/Verdana.xml:
> /home/jheinicke/development/IUPB/iupb/nullwebapps/ROOT/doc/fop/fonts/Verdana.xml
>
>
> --------------------------------------^^^^
Don't know; was working for me last time I tested.
>> FOP supports only links to the fonts in absolute file format,
>> starting with "C:/", because currently there is no way to tell FOP
>> current context. No support for Cocoon URIs, for now. See
>> http://xml.apache.org/cocoon/userdocs/serializers/pdf-serializer.html.
>
>
> Why must it be absolute paths now? In Cocoon 2.0.3 with Fop 0.20.3 the
> relative paths worked without any problems. But no longer in Cocoon
> 2.0.4 with Fop 0.20.4?
Not that it *must*... Yes it should work with relative path. But these
paths will be relative to the current working directory of JVM - not
relative to webapp context or sitemap. Because of this, it is easier to
say that paths to the fonts must be absolute paths.
Vadim
---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org
Re: FOP, inline SVG, fonts
Posted by Joerg Heinicke <jo...@gmx.de>.
Hello Vadim,
Vadim Gritsenko wrote:
> Frank made a mistake... New configuration syntax which supports Cocoon
> protocols looks like:
>
> <user-config>context://webapps/ROOT/doc/fop/config.xml</user-config>
>
> Old configuration (with src attribute) does not support protocols, works
> only with file name (see FOPSerializer.java).
I tested the new configuration of the pdf serializer, but no luck. The
userconfig file is found as before (but yeah, I use the new configuration
;-), but there is still a null in the path to the fonts:
Failed to read font metrics file nullwebapps/ROOT/doc/fop/fonts/Verdana.xml:
/home/jheinicke/development/IUPB/iupb/nullwebapps/ROOT/doc/fop/fonts/Verdana.xml
--------------------------------------^^^^
> FOP supports only links to the fonts in absolute file format, starting
> with "C:/", because currently there is no way to tell FOP current
> context. No support for Cocoon URIs, for now. See
> http://xml.apache.org/cocoon/userdocs/serializers/pdf-serializer.html.
Why must it be absolute paths now? In Cocoon 2.0.3 with Fop 0.20.3 the
relative paths worked without any problems. But no longer in Cocoon 2.0.4
with Fop 0.20.4?
But I got excalibur source resolving to work in *a* way with Cocoon 2.1 or
better said with excalibur-sourceresolve-20030130.jar. I don't know how good
or bad it is. Interests?
Regards,
Joerg
--
System Development
VIRBUS AG
Fon +49(0)341-979-7419
Fax +49(0)341-979-7409
joerg.heinicke@virbus.de
www.virbus.de
CeBIT 2003 vom 12. bis zum 19. März in Hannover
VIRBUS stellt gemeinsam mit der IBM-Tochter IT-Services and Solutions
GmbH aus.
Lassen Sie sich überraschen von den neuen, umfassenden Möglichkeiten im
Internet-gestützten Zahlungsverkehr.
Besuchen Sie uns: Halle 3, Stand D55.
---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org
Re: FOP, inline SVG, fonts
Posted by Joerg Heinicke <jo...@gmx.de>.
Is there any reason, why the src-attribute is not used in the new
implementation? Backwards compatibility could not be the reason, because
as you can see for my example, it only breaks the working without any
claiming on the changed configuration. And if it is the general
configuration scheme (not using attributes, but the text nodes), why
src-attribute is not completely deactivated or at least throwing a warning?
Hmm, I had a look on the FOPSerializer and saw the deprecated url
resolving. I tried to jump into the excalibur sourceresolve water, but
the water is to deep, I got lost ;-) I would need Carsten's help or an
already working example of the new source resolving.
Of course I can provide a patch for the userdocs. I will have a look on
it in the next days. But what about Javadoc? I don't know what to do ...
Regards,
Joerg
Vadim Gritsenko wrote:
> Joerg Heinicke wrote:
>
>> Vadim, can you please add the changed configuration of pdf serializer
>> to the documentation? There is only the src-attribute mentioned.
>
>
>
> Not only documentation is outdated... Javadoc is missing too!
>
> Care to provide a patch? ;-)
>
> Vadim
---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org
Re: FOP, inline SVG, fonts
Posted by Vadim Gritsenko <va...@verizon.net>.
Joerg Heinicke wrote:
> Vadim, can you please add the changed configuration of pdf serializer
> to the documentation? There is only the src-attribute mentioned.
Not only documentation is outdated... Javadoc is missing too!
Care to provide a patch? ;-)
Vadim
---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org
Re: FOP, inline SVG, fonts
Posted by Joerg Heinicke <jo...@gmx.de>.
Hello Vadim,
> Frank made a mistake... New configuration syntax which supports Cocoon
> protocols looks like:
>
> <user-config>context://webapps/ROOT/doc/fop/config.xml</user-config>
>
> Old configuration (with src attribute) does not support protocols, works
> only with file name (see FOPSerializer.java).
Ah, thanks. So at least Cocoon 2.0.4 should work completely.
>> And when changing only the links to the font files in config.xml
>> using context:// protocol:
>
> FOP supports only links to the fonts in absolute file format, starting
> with "C:/", because currently there is no way to tell FOP current
> context. No support for Cocoon URIs, for now. See
> http://xml.apache.org/cocoon/userdocs/serializers/pdf-serializer.html.
It was only a test. As I wrote in my original mail, I have relative
paths in my config file, what seems to work.
Vadim, can you please add the changed configuration of pdf serializer to
the documentation? There is only the src-attribute mentioned.
Regards,
Joerg
---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org
Re: FOP, inline SVG, fonts
Posted by Vadim Gritsenko <va...@verizon.net>.
Joerg Heinicke wrote:
> Hello Frank,
>
> sorry, but this doesn't work in both Cocoon versions. I tested it some
> time ago with Cocoon 2.0.3 and now with with 2.0.4:
Frank made a mistake... New configuration syntax which supports Cocoon
protocols looks like:
<user-config>context://webapps/ROOT/doc/fop/config.xml</user-config>
Old configuration (with src attribute) does not support protocols, works
only with file name (see FOPSerializer.java).
...
> And when changing only the links to the font files in config.xml using
> context:// protocol:
FOP supports only links to the fonts in absolute file format, starting
with "C:/", because currently there is no way to tell FOP current
context. No support for Cocoon URIs, for now. See
http://xml.apache.org/cocoon/userdocs/serializers/pdf-serializer.html.
> 2003-03-11 18:23:22,125 INFO [org.jboss.web.localhost.Engine] ERROR
> (2003-03-11) 18:23.22:124 [manager.] (/conweb/stream.secure.pdf)
> Thread-7/MessageHandler: Failed to read font metrics file
> nullcontext://webapps/ROOT/doc/fop/fonts/Verdana.xml : unknown
> protocol: nullcontext
>
>
> And with Batik: it's one of the most simplest SVG possible: basic
> shapes, rect in SVG spec. Furthermore (again the stacktrace) the NPE
> happens in a Fop class:
>
> javax.xml.transform.TransformerException: java.lang.NullPointerException
> at
> org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.java:1226)
>
> at
> org.apache.xalan.transformer.TransformerImpl.run(TransformerImpl.java:3135)
>
> at java.lang.Thread.run(Thread.java:536)
> Caused by: java.lang.NullPointerException
> at
> org.apache.fop.render.pdf.fonts.LazyFont.getAscender(Unknown Source)
> at org.apache.fop.layout.FontState.getAscender(Unknown Source)
Don't know solution for this one, but try disabling incremental processing.
Vadim
> Even it brought no solution, thanks for your help.
>
> Joerg
---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org
Re: FOP, inline SVG, fonts
Posted by Joerg Heinicke <jo...@gmx.de>.
Hello Frank,
sorry, but this doesn't work in both Cocoon versions. I tested it some time
ago with Cocoon 2.0.3 and now with with 2.0.4:
2003-03-11 18:26:33,236 INFO [org.jboss.web.localhost.Engine] DEBUG
(2003-03-11) 18:26.33:210 [manager ] (/conweb/stream.secure.pdf)
Thread-7/ExcaliburComponentSelector: UnnamedSelector: ComponentSelector
could not access the Component for hint [pdf]
org.apache.avalon.framework.configuration.ConfigurationException: Cannot
load configuration from
file:/home/jheinicke/development/IUPB/iupb/context:/webapps/ROOT/doc/fop/config.xml
at
org.apache.cocoon.serialization.FOPSerializer.configure(FOPSerializer.java:196)
at
org.apache.avalon.excalibur.component.DefaultComponentFactory.newInstance(DefaultComponentFactory.java:264)
And when changing only the links to the font files in config.xml using
context:// protocol:
2003-03-11 18:23:22,125 INFO [org.jboss.web.localhost.Engine] ERROR
(2003-03-11) 18:23.22:124 [manager.] (/conweb/stream.secure.pdf)
Thread-7/MessageHandler: Failed to read font metrics file
nullcontext://webapps/ROOT/doc/fop/fonts/Verdana.xml : unknown protocol:
nullcontext
And with Batik: it's one of the most simplest SVG possible: basic shapes,
rect in SVG spec. Furthermore (again the stacktrace) the NPE happens in a
Fop class:
javax.xml.transform.TransformerException: java.lang.NullPointerException
at
org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.java:1226)
at
org.apache.xalan.transformer.TransformerImpl.run(TransformerImpl.java:3135)
at java.lang.Thread.run(Thread.java:536)
Caused by: java.lang.NullPointerException
at org.apache.fop.render.pdf.fonts.LazyFont.getAscender(Unknown Source)
at org.apache.fop.layout.FontState.getAscender(Unknown Source)
Even it brought no solution, thanks for your help.
Joerg
Frank Taffelt wrote:
>><map:serializer name="pdf" mime-type="application/pdf"
>>src="org.apache.cocoon.serialization.FOPSerializer">
>> <user-config src="webapps/ROOT/doc/fop/config.xml"/>
>></map:serializer>
>
>
> you should try <user-config
> src="context://webapps/ROOT/doc/fop/config.xml"/>.
>
> On the other side the problem can be bug in batik which occurs as a NPE.
> When using internal url targets in your fo:instream-foreign-object this
> problem is present. This bug is fixed in current batik version 1.5 beta4.
> This solved some of my problem's i had with current HEAD (cocoon-2.1).
>
> hth,
> Frank
--
System Development
VIRBUS AG
Fon +49(0)341-979-7419
Fax +49(0)341-979-7409
joerg.heinicke@virbus.de
www.virbus.de
CeBIT 2003 vom 12. bis zum 19. März in Hannover
VIRBUS stellt gemeinsam mit der IBM-Tochter IT-Services and Solutions
GmbH aus.
Lassen Sie sich überraschen von den neuen, umfassenden Möglichkeiten im
Internet-gestützten Zahlungsverkehr.
Besuchen Sie uns: Halle 3, Stand D55.
---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org
Re: FOP, inline SVG, fonts
Posted by Frank Taffelt <fr...@interface-business.de>.
> <map:serializer name="pdf" mime-type="application/pdf"
> src="org.apache.cocoon.serialization.FOPSerializer">
> <user-config src="webapps/ROOT/doc/fop/config.xml"/>
> </map:serializer>
you should try <user-config
src="context://webapps/ROOT/doc/fop/config.xml"/>.
On the other side the problem can be bug in batik which occurs as a NPE.
When using internal url targets in your fo:instream-foreign-object this
problem is present. This bug is fixed in current batik version 1.5 beta4.
This solved some of my problem's i had with current HEAD (cocoon-2.1).
hth,
Frank
---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org