Re: SV: external-graphic src syntax

2002-03-13 Thread Michael Engelhart
Hmm.  Now that I know the syntax it works.
Maybe I was just screwing put the long path name..
Thanks
Mike
On Wednesday, March 13, 2002, at 06:58  AM, Magnus Sjöberg wrote:
I use Fop 0.20.2 and as long as the path to the imagefile is
absolute, it works.
Like so: fo:external-graphic
src=file:/abs/path/to/images/image.jpg/
Also, there is an entry in Fop's config.xml where you can
set the basedir but the comment says 'not implemented'.
If, and when this entry gets supported, that should be the
place where you specify the basedir, enabling relative file
paths.
///Magnus
Klosa Uwe wrote:
It works only with fop0_19_0. All fop0_20_x has the same error. I've 
tried
it in two days now.

Uwe
-Ursprungligt meddelande-
Fran: Michael Engelhart [mailto:[EMAIL PROTECTED]
Skickat: den 12 mars 2002 16:28
Till: [EMAIL PROTECTED]
Amne: external-graphic src syntax
Can someone show me the syntax to using
fo:external-graphic??
I have an image in the same directory as the stylsheet and have tried
this syntax:
fo:block text-align=center
 fo:external-graphic src=logo.jpg/
/fo:block
this syntax:
fo:block text-align=center
 fo:external-graphic src=file:./logo.jpg/
/fo:block
this syntax:
fo:block text-align=center
 fo:external-graphic src=file://./logo.jpg/
/fo:block
and none of them work.  I always get this error:
[ERROR]: Error while creating area : Error with image URL: ./logo.jpg
(No such file or directory) and no base directory is specified
I have compared this to the images.fo example document as well as the
W3C XSL spec and it doesn't work.
I can sort of get it to work using an external url like
http://somewhere.com/logo.jpg; but when I do it that way my 
application
hangs and never comes back.

any ideas??



Re: SV: SV: external-graphic src syntax

2002-03-13 Thread Michael Engelhart
Thanks Mangus,
That's great info.  (Maybe we can get it stuck into the FAQ? )
I know have 2 working fine.  1 and 3 I still can't get to work
My question about #1 is, how do you know what the relative path is 
relative too?? I my mind it should be relative to the stylesheet that's 
calling it  but in my experience that doesn't work at all.

For example if I have this setup:
directory
	- doc.xsl (which does a dynamic transform with Xalan into an FO 
document)
	- logo.jpg

The src=logo.jpg tag makes FOP complain about  the Invalid URL image.
thanks
Mike
On Wednesday, March 13, 2002, at 08:44  AM, Magnus Sjöberg wrote:
Ok, you got me started. I looked into this and found out the
following ;-)
In the xsl spec., the src attribute for
fo:external-graphic is specified to contain a
'uri-specification'
For all I know, this is the URI definition as defined in
RFC2396.
Looking into this and comparing the three attribute values
that failed I came up with this:
1) src=logo.jpg
This should work since 'logo.jpg' is a correct relative URI
according to the BNF
2) src=file:./logo.jpg
This should also work since 'file:./logo.jpg' defines a
correct absoluteURI.
3) src=file://./logo.jpg
This defines an absolute URI, but the file:// should be
followed by a 'server' or a 'reg_name' according to the RFC.
I believe that the code parsing the file://./logo.jpg treats
the . after 'file://' as a server name, hence the URL error.
Of the three I got 1 and 2 working using Fop-0.20.2,
Xalan-2.3.0 and Xerces-2.0.0 (which is good, since they s h
o u l d work).
Example 3 failed, complaining about Invalid Image URL -
error on relative URL, which I believe is a correct error
message.
The relative URL really is incorrect.
I also used a relative URI as in
src=/root/path/to/images/image.jpg, which worked. (Note
the missing file:)
Hope this 'clears' up some of the fog.
Rgds///
Magnus



Re: SV: SV: external-graphic src syntax

2002-03-13 Thread Michael Engelhart
I have the same setup but I'm calling FOP from an embedded application 
(NOT a web application - no tomcat or other server).
Here's the code from my render() method:

ByteArrayOutputStream out = new ByteArrayOutputStream();
DOMResult xslFODomResult = 
transformPDF(/some/pathto/a/stylesheet/pdf.xsl);
Driver driver = new Driver();
driver.setRenderer(driver.RENDER_PDF);
driver.setOutputStream(out);
org.w3c.dom.Document foDoc =(org.w3c.dom.Document) 
xslFODomResult.getNode();
driver.render(foDoc);			
return (out.toByteArray());

That's why I'm trying to figure out where FOP is getting the directory 
path to image.jpg from.   It doesn' t work in this situation.
Is FOP using some kind of classpath directory???

Thanks
Mike
On Wednesday, March 13, 2002, at 09:59  AM, Magnus Sjöberg wrote:
That's bizarre, I 'assumed' FOP used the current directory
as its base dir...
I ran the following command with test.xml, test.xsl and
image.jpg in the current directory:
current_dir java org.apache.fop.apps.Fop -xml test.xml -xsl
test.xsl -pdf test.pdf
All images in the xml are added to the fo using
fo:external-graphic src=image.jpg/
This produces no errors.
Exactly what sequence of events are you using to create the
PDF?
///Magnus



external-graphic src syntax

2002-03-12 Thread Michael Engelhart
Can someone show me the syntax to using
fo:external-graphic??
I have an image in the same directory as the stylsheet and have tried 
this syntax:

fo:block text-align=center
fo:external-graphic src=logo.jpg/
/fo:block
this syntax:
fo:block text-align=center
fo:external-graphic src=file:./logo.jpg/
/fo:block
this syntax:
fo:block text-align=center
fo:external-graphic src=file://./logo.jpg/
/fo:block
and none of them work.  I always get this error:
[ERROR]: Error while creating area : Error with image URL: ./logo.jpg 
(No such file or directory) and no base directory is specified

I have compared this to the images.fo example document as well as the 
W3C XSL spec and it doesn't work.
I can sort of get it to work using an external url like 
http://somewhere.com/logo.jpg; but when I do it that way my application 
hangs and never comes back.

any ideas??


Re: SV: external-graphic src syntax

2002-03-12 Thread Michael Engelhart
Thanks - i guess for now I'll run a web server on the local machine.  For some reason that doesn't hang my application but when I reference it to an external URL, it hangs. 

Mike
On Tuesday, March 12, 2002, at 10:45  AM, Klosa Uwe wrote:

It works only with fop0_19_0. All fop0_20_x has the same error. I've tried
it in two days now.

Uwe


Re: Re : mailto (does not work)

2002-03-12 Thread Michael Engelhart
Hmm. i just tried the exact same example that was posted and it works 
fine.   Do you have the mailto: protocol linked to use your browser 
rather than your email client?

On Tuesday, March 12, 2002, at 10:52  AM, MARTIN Franck wrote:
Thank you for your suggestions but using the fo:basic-link tag with the
external-destination attribute does not work for me.
When I click on the link in the generated PDF file it opens a web
browser with the following URL : http://mailto:{mailto:[EMAIL PROTECTED]
!!! (or http://mailto:mailto:[EMAIL PROTECTED])
Does anyone knows the right thing to do?
Franck MARTIN



Re: problems with fo:external-graphic

2002-03-12 Thread Michael Engelhart
I'm not using Tomcat.  I just have a standalone application that I'm using.   All the libraries are in a directory that I add to my classpath.   The error I'm getting is that the image is not found.

Thanks

mike
On Tuesday, March 12, 2002, at 11:17  AM, Guillaume Laforge wrote:

Hello Michael,
 
Do you still have the same problem ? (SVGDocument class not found ?)
I've got the same problem. It heavily depends on your tomcat version you are using.
A quick hack for me was to move batik.jar from my WEB-INF/lib directory to Tomcat's common/lib.
It works, but it's not very cool if you wish to make a deployable archive (a WAR file), because you have to install the WAR, AND THEN : Batik.jar in common/lib.
I think the problem comes from Tomcat itself, in the way it loads the jar files. The custom class loaders behaves totally differently between Tomcat 3.2 and Tomcat 4.0.x. And even between Tomcat 4.0.1, 2 and 3 
I dont have the problem with Tomcat 4.0.1 (jdk1.3.1 on Linux and on Windows2K) and the problem appears with Tomcat 4.0.3 on W2K. 
Did you find another solution to this problem ?
 
Guillaume


Logger not set

2002-03-11 Thread Michael Engelhart
Hi all,
Does it matter if I just ignore setting the logger?  I already have an 
application built around using Log4J and it seems silly to instantiate 
another logging system just to output 3 lines every time I run FOP.   I 
just want to make sure that there isn't anything  critical to the 
setLogger method

thanks
Mike


Re: Logger not set

2002-03-11 Thread Michael Engelhart
Hi all,
Does it matter if I just ignore setting the logger?  I already have an 
application built around using Log4J and it seems silly to instantiate 
another logging system just to output 3 lines every time I run FOP.   I 
just want to make sure that there isn't anything  critical to the 
setLogger method

thanks
Mike


application freezing problem

2002-03-08 Thread Michael Engelhart
Hi,
I have a gui java application that does a FO to PDF rendering so that it 
can in turn send out an email with the PDF as an attachment.I use 
the following FOP code to do this:

public byte[] renderFO() {
ByteArrayOutputStream out = new ByteArrayOutputStream();
FileInputStream file = new FileInputStream(pdf.fo);
InputSource foFile = new InputSource(file);
Driver driver = new Driver(foFile, out);
driver.setRenderer(Driver.RENDER_PDF);
driver.run();
return out.toByteArray();
}
I then pass the byte array  to my custom DataSource class that is then 
stuffed into a DataHandler that is passed to the JavaMail Message object 
as the content.  The code for the DataSource is this:

class ByteArrayDataSource implements DataSource
{
ByteArrayDataSource(String data, String type) {
try {
this.data = data.getBytes(iso-8859-1);
}
catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
this.type = type;
}
ByteArrayDataSource(byte[] data, String type) {
this.data = data;
this.type = type;
}
   public InputStream getInputStream() throws IOException {
if (data == null)
throw new IOException(no data);
return new ByteArrayInputStream(data);
}
public OutputStream getOutputStream() throws IOException {
throw new IOException(cannot do this);
}
public String getContentType()  {
return type;
}
public String getName() {
return mydatasource;
}
private byte[] data; // data
private String type; // content-type
}
So, the problem is that the code works (i.e., the PDF is rendered, the 
email attachment is attached and sent), except that as soon as the email 
message is sent and the code is returned back to the main thread of the 
application, it just hangs.   The GUI becomes unusable and I have to 
kill the application.  The app actually continues to run though but as I 
said it's unusable since the GUI freezes up.   If I remove the 3 lines:

Driver driver = new Driver(foFile, out);
driver.setRenderer(Driver.RENDER_PDF);
driver.run();
then the code runs fine (although the PDF file isn't rendered) and the 
application runs as expected.   I'm stumped as to what is going on here.

I'm running this on  Mac OS X, Java 2 (1.3.1), 768MB RAM.The 
application is a Java/Cocoa application so it's not 100% pure java but I 
still don't know why the 3 lines of coded needed to render  a PDF would 
cause this.

Any advice would be greatly appreciated.
Thanks
Mike


Re: application freezing problem

2002-03-08 Thread Michael Engelhart
One more thing.  I'm using the FOP  0.20.3 distribution and associated 
Jar files that come in the lib directory of the distro.

Thanks
Mike
On Thursday, March 7, 2002, at 08:27  PM, Michael Engelhart wrote:
Hi,
I have a gui java application that does a FO to PDF rendering so that 
it can in turn send out an email with the PDF as an attachment.I 
use the following FOP code to do this:

public byte[] renderFO() {
ByteArrayOutputStream out = new ByteArrayOutputStream();
FileInputStream file = new FileInputStream(pdf.fo);
InputSource foFile = new InputSource(file);
Driver driver = new Driver(foFile, out);
driver.setRenderer(Driver.RENDER_PDF);
driver.run();
return out.toByteArray();
}
I then pass the byte array  to my custom DataSource class that is then 
stuffed into a DataHandler that is passed to the JavaMail Message 
object as the content.  The code for the DataSource is this:

class ByteArrayDataSource implements DataSource
{
ByteArrayDataSource(String data, String type) {
try {
this.data = data.getBytes(iso-8859-1);
}
catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
this.type = type;
}
ByteArrayDataSource(byte[] data, String type) {
this.data = data;
this.type = type;
}
   public InputStream getInputStream() throws IOException {
if (data == null)
throw new IOException(no data);
return new ByteArrayInputStream(data);
}
public OutputStream getOutputStream() throws IOException {
throw new IOException(cannot do this);
}
public String getContentType()  {
return type;
}
public String getName() {
return mydatasource;
}
private byte[] data; // data
private String type; // content-type
}
So, the problem is that the code works (i.e., the PDF is rendered, 
the email attachment is attached and sent), except that as soon as the 
email message is sent and the code is returned back to the main thread 
of the application, it just hangs.   The GUI becomes unusable and I 
have to kill the application.  The app actually continues to run though 
but as I said it's unusable since the GUI freezes up.   If I remove the 
3 lines:

Driver driver = new Driver(foFile, out);
driver.setRenderer(Driver.RENDER_PDF);
driver.run();
then the code runs fine (although the PDF file isn't rendered) and the 
application runs as expected.   I'm stumped as to what is going on here.

I'm running this on  Mac OS X, Java 2 (1.3.1), 768MB RAM.The 
application is a Java/Cocoa application so it's not 100% pure java but 
I still don't know why the 3 lines of coded needed to render  a PDF 
would cause this.

Any advice would be greatly appreciated.
Thanks
Mike