Re: Need Some Help

2005-01-07 Thread tts 22
I set "file:///C:\fop-0.20.5\msmincho.xml" in userconfig.xml.
(BAnd this made creation of PDF in shift_jis through servlet, which
(Bin fact, I had given up making one.(it is one of FAQ?!!) 
(B
(Byou helped me great, thank you.
(B
(Btts6 
(B
(B>From: Jeremias Maerki <[EMAIL PROTECTED]>
(B>Reply-To: [EMAIL PROTECTED]
(B>To: [EMAIL PROTECTED]
(B>Subject: Re: Need Some Help
(B>Date: Fri, 07 Jan 2005 07:57:26 +0100
(B>
(B>Are you using relative URLs in userconfig.xml? If yes, you need to set
(B>the baseDir/baseURL (or fontBaseDir, if it is different from baseDir)
(B>accordingly. The other possibility is to use absolute paths or URLs.
(B>
(B>http://xml.apache.org/fop/faq.html#fonts-not-found
(B>http://xml.apache.org/fop/embedding.html#config-internal
(B>http://xml.apache.org/fop/configuration.html#summary-key-value
(B>
(B>I answered something similar just two days ago:
(B>http://mail-archives.apache.org/eyebrowse/[EMAIL PROTECTED]&msgNo=12960
(B
(B>
(B>If that doesn't help please show us your userconfig.xml.
(B>
(B>On 07.01.2005 06:33:10 tts 22 wrote:
(B> > Following your instruction, builded successfully.
(B> >
(B> > but Tomcat's errors.
(B> > [ERROR] Logger not set
(B> > [ERROR] Failted to read a font metrics file: Invalid font metrics file:
(B> > msmincho.xml (no protpcol: msmincho.xml)
(B> > [ERROR] unknown font Mincho, so defaulted font to any
(B> >
(B> > Can I  have any hint?
(B>
(B>
(B>Jeremias Maerki
(B>
(B>
(B>-
(B>To unsubscribe, e-mail: [EMAIL PROTECTED]
(B>For additional commands, e-mail: [EMAIL PROTECTED]
(B>
(B
(B_
$BF|K\9qFb:GBg5i(B570$BK|%f!<%6!<$N(BMSN Hotmail 
(Bhttps://registernet.passport.net/reg.srf?id=2&lc=1041 
(B
(B
(B-
(BTo unsubscribe, e-mail: [EMAIL PROTECTED]
(BFor additional commands, e-mail: [EMAIL PROTECTED]

Re: Need Some Help

2005-01-07 Thread Jeremias Maerki
Are you using relative URLs in userconfig.xml? If yes, you need to set
the baseDir/baseURL (or fontBaseDir, if it is different from baseDir)
accordingly. The other possibility is to use absolute paths or URLs.

http://xml.apache.org/fop/faq.html#fonts-not-found
http://xml.apache.org/fop/embedding.html#config-internal
http://xml.apache.org/fop/configuration.html#summary-key-value

I answered something similar just two days ago:
http://mail-archives.apache.org/eyebrowse/[EMAIL PROTECTED]&msgNo=12960

If that doesn't help please show us your userconfig.xml.

On 07.01.2005 06:33:10 tts 22 wrote:
> Following your instruction, builded successfully.
> 
> but Tomcat's errors.
> [ERROR] Logger not set
> [ERROR] Failted to read a font metrics file: Invalid font metrics file: 
> msmincho.xml (no protpcol: msmincho.xml)
> [ERROR] unknown font Mincho, so defaulted font to any
> 
> Can I  have any hint?


Jeremias Maerki


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Need Some Help

2005-01-07 Thread tts 22
Hi
(B
(BFollowing your instruction, builded successfully.
(B
(Bbut Tomcat's errors.
(B[ERROR] Logger not set
(B[ERROR] Failted to read a font metrics file: Invalid font metrics file: 
(Bmsmincho.xml (no protpcol: msmincho.xml)
(B[ERROR] unknown font Mincho, so defaulted font to any
(B
(BCan I  have any hint?
(B
(B>From: Jeremias Maerki <[EMAIL PROTECTED]>
(B>Reply-To: [EMAIL PROTECTED]
(B>To: [EMAIL PROTECTED]
(B>Subject: Re: Need Some Help
(B>Date: Thu, 06 Jan 2005 15:13:04 +0100
(B>
(B>If you mean:
(B>
(B>File userConfigFile = new File("C:\\fop\\conf\\userconfig.xml");
(B>new Options(userConfigFile);
(B>
(B>...then, yes.
(B>
(B>On 06.01.2005 14:58:12 tts 22 wrote:
(B> > File userConfigFile = new File("C:\\fop\\conf\\userconfig.xml");
(B> >
(B> > is this ok?
(B>
(B>
(B>Jeremias Maerki
(B>
(B>
(B>-
(B>To unsubscribe, e-mail: [EMAIL PROTECTED]
(B>For additional commands, e-mail: [EMAIL PROTECTED]
(B>
(B
(B_
$BL5NA(B250MB$B%a!<%k%\%C%/%9$N(BMSN Hotmail 
(Bhttps://registernet.passport.net/reg.srf?id=2&lc=1041 
(B
(B
(B-
(BTo unsubscribe, e-mail: [EMAIL PROTECTED]
(BFor additional commands, e-mail: [EMAIL PROTECTED]

Re: Need Some Help

2005-01-06 Thread Jeremias Maerki
If you mean: 

File userConfigFile = new File("C:\\fop\\conf\\userconfig.xml");
new Options(userConfigFile);

...then, yes.

On 06.01.2005 14:58:12 tts 22 wrote:
> File userConfigFile = new File("C:\\fop\\conf\\userconfig.xml");
> 
> is this ok?


Jeremias Maerki


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Need Some Help

2005-01-06 Thread tts 22
thanks
(B
(BFile userConfigFile = new File("C:\\fop\\conf\\userconfig.xml");
(B
(Bis this ok?
(B
(Btts6
(B
(B>From: Jeremias Maerki <[EMAIL PROTECTED]>
(B>Reply-To: [EMAIL PROTECTED]
(B>To: [EMAIL PROTECTED]
(B>Subject: Re: Need Some Help
(B>Date: Thu, 06 Jan 2005 13:13:57 +0100
(B>
(B>Sure, please see here: 
(Bhttp://xml.apache.org/fop/embedding.html#config-external
(B>It describes how to use the userconfig.xml file from Java.
(B>
(B>On 06.01.2005 13:02:20 tts 22 wrote:
(B> > Can Font Metric msmincho.xml  be refered in this Luke's FopServlet?
(B>
(B>
(B>Jeremias Maerki
(B>
(B>
(B>-
(B>To unsubscribe, e-mail: [EMAIL PROTECTED]
(B>For additional commands, e-mail: [EMAIL PROTECTED]
(B>
(B
(B_
(BMSN Hotmail$B$G3+1?%a%k%"[EMAIL PROTECTED]http://promotion.msn.co.jp/hotmail/fortune/input_un.asp 
(B
(B
(B-
(BTo unsubscribe, e-mail: [EMAIL PROTECTED]
(BFor additional commands, e-mail: [EMAIL PROTECTED]

RE: Need Some Help

2005-01-06 Thread Mark Donnelly
Please ignore this request. Ive found it. FYI its:

users@cocoon.apache.org

Mark

-Original Message-
From: Mark Donnelly [mailto:[EMAIL PROTECTED]
Sent: 06 January 2005 12:47
To: '[EMAIL PROTECTED]'
Subject: RE: Need Some Help


I know this is the wrong venue but Im having trouble locating a similar
Cocoon mailing list. Ive tried:

[EMAIL PROTECTED]

with no success. Anyone suscribe to the Cocoon mailing list who can help me?

-Original Message-
From: Luke Shannon [mailto:[EMAIL PROTECTED]
Sent: 05 January 2005 23:36
To: [EMAIL PROTECTED]
Subject: Re: Need Some Help


Thank you Andreas! Works very well.

- Original Message - 
From: "Andreas L. Delmelle" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, January 05, 2005 6:21 PM
Subject: RE: Need Some Help


> > -Original Message-
> > From: Luke Shannon [mailto:[EMAIL PROTECTED]
> >
>
> Hi,
>
> > My new issue is how to render the PDF with a string input containing the
> > contents of the FO file.
>
> From java.lang.String to java.io.StringReader to java.io.Reader to
> org.xml.sax.InputSource?
>
> HTH!
>
> Greetz,
>
> Andreas
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Need Some Help

2005-01-06 Thread Mark Donnelly
I know this is the wrong venue but Im having trouble locating a similar
Cocoon mailing list. Ive tried:

[EMAIL PROTECTED]

with no success. Anyone suscribe to the Cocoon mailing list who can help me?

-Original Message-
From: Luke Shannon [mailto:[EMAIL PROTECTED]
Sent: 05 January 2005 23:36
To: [EMAIL PROTECTED]
Subject: Re: Need Some Help


Thank you Andreas! Works very well.

- Original Message - 
From: "Andreas L. Delmelle" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, January 05, 2005 6:21 PM
Subject: RE: Need Some Help


> > -Original Message-
> > From: Luke Shannon [mailto:[EMAIL PROTECTED]
> >
>
> Hi,
>
> > My new issue is how to render the PDF with a string input containing the
> > contents of the FO file.
>
> From java.lang.String to java.io.StringReader to java.io.Reader to
> org.xml.sax.InputSource?
>
> HTH!
>
> Greetz,
>
> Andreas
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Need Some Help

2005-01-06 Thread Jeremias Maerki
Sure, please see here: http://xml.apache.org/fop/embedding.html#config-external
It describes how to use the userconfig.xml file from Java.

On 06.01.2005 13:02:20 tts 22 wrote:
> Can Font Metric msmincho.xml  be refered in this Luke's FopServlet?


Jeremias Maerki


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Need Some Help

2005-01-06 Thread tts 22
Hello
(B
(BExcuse me for a give-me-a-ride question.
(BCan Font Metric msmincho.xml  be refered in this Luke's FopServlet?
(B
(Btts6
(B>
(B
(B>Responding to myself.
(B
(B>I have found the problem, this code below works. I am still interested if
(B>anyone knows better way to do this.
(B
(B>Thanks,
(B
(B>Luke
(B
(B/*
(B * Test class to get this FOP stuff working
(B */
(B
(Bimport java.io.*;
(Bimport javax.servlet.*;
(Bimport javax.servlet.http.*;
(Bimport org.apache.fop.apps.Driver;
(Bimport org.xml.sax.*;
(B
(B/**
(B * This class is intended to demonstrate submitting a FO document in memory
(B * (String) to FOP and write a PDF document to the server.
(B */
(Bpublic class FopServlet extends HttpServlet {
(B
(Bpublic void doGet(HttpServletRequest request, HttpServletResponse
(Bresponse)
(Bthrows ServletException {
(Btry {
(B//the input
(BFile fofile = new
(BFile("D:\\applications\\fop\\fop-0.20.5\\test.fo");
(B//location to write to
(BFile indexPDF = new
(BFile("D:\\applications\\fop\\fop-0.20.5\\index.pdf");
(B//create an input stream from the input file
(BInputStream in = new FileInputStream(fofile);
(B//FOP Driver
(BDriver driver = new Driver();
(B//set the render type
(Bdriver.setRenderer(Driver.RENDER_PDF);
(B//Setup output stream
(BOutputStream out = new FileOutputStream(indexPDF);
(Bout = new BufferedOutputStream(out);
(B//configure the input and the output
(Bdriver.setInputSource(new
(BInputSource("D:\\applications\\fop\\fop-0.20.5\\test.fo"));
(Bdriver.setOutputStream(out);
(B//run the driver
(Bdriver.run();
(Bout.close();
(BPrintWriter output = response.getWriter();
(Boutput.println("Success\n"
(B+ "Nice Work!");
(B} catch (Exception ex) {
(Bthrow new ServletException(ex);
(B}
(B}
(B}
(B- Original Message - 
(BFrom: "Luke Shannon" <[EMAIL PROTECTED]>
(BTo: <[EMAIL PROTECTED]>
(BSent: Wednesday, January 05, 2005 4:58 PM
(BSubject: Need Some Help
(B
(B_
$BL5NA(B250MB$B%a!<%k%\%C%/%9$N(BMSN Hotmail 
(Bhttps://registernet.passport.net/reg.srf?id=2&lc=1041 
(B
(B
(B-
(BTo unsubscribe, e-mail: [EMAIL PROTECTED]
(BFor additional commands, e-mail: [EMAIL PROTECTED]

Re: Need Some Help

2005-01-06 Thread Luke Shannon
Thank you Andreas! Works very well.

- Original Message - 
From: "Andreas L. Delmelle" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, January 05, 2005 6:21 PM
Subject: RE: Need Some Help


> > -Original Message-
> > From: Luke Shannon [mailto:[EMAIL PROTECTED]
> >
>
> Hi,
>
> > My new issue is how to render the PDF with a string input containing the
> > contents of the FO file.
>
> From java.lang.String to java.io.StringReader to java.io.Reader to
> org.xml.sax.InputSource?
>
> HTH!
>
> Greetz,
>
> Andreas
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Need Some Help

2005-01-05 Thread Andreas L. Delmelle
> -Original Message-
> From: Luke Shannon [mailto:[EMAIL PROTECTED]
>

Hi,

> My new issue is how to render the PDF with a string input containing the
> contents of the FO file.

>From java.lang.String to java.io.StringReader to java.io.Reader to
org.xml.sax.InputSource?

HTH!

Greetz,

Andreas


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Need Some Help

2005-01-05 Thread Andreas L. Delmelle
> -Original Message-
> From: Luke Shannon [mailto:[EMAIL PROTECTED]
>

Hi,

I see you've already discovered it yourself, but here's a bit more info on
why I think it went wrong...

> Below is my code.
>
> When I run it in IE it get a Pop up message telling me the "File does not
> begin with '%PDF-'". This is weird to me because I am not trying
> to send it back through the response object, I don't know why the browser
is even
> looking at it.
>

It may be weird, but it does point out one serious mistake:

> //get the content
> String pdfFileContent = out.toString();

PDF is not 'just text', so it's wrong to use a String to represent it. That
is not to say a PDF can't be opened in a text-editor --it can, but changing
a character and saving can seriously muck up the binary portions of the
file... not to mention prepend it with UTF-garbage.
The error message is Acrobat's IE-plugin complaining, and refers to the PDF
specification. A PDF file is supposed to start with:
%PDF-{version-number}
followed by a few (three or four... will have to look that up :-)) non-text
bytes.
These latter bytes will become 'characters' when you pass them through a
String, so the end-result is likely a corrupt PDF file, even if you're not
trying to display it.

> When I run it in FireFox I get my success message printed, and
> the document created. However when I trying and open it I am
> told there is a Sharing Violation.
> The writer was closed before I printed the success statement so I
> am not sure where the conflict came from.

Well... I don't fully agree. Keep in mind that in your initial code, the
physical PDF-file was referenced (for read/write access) by three different
objects: one File, and an OutputStream and a FileWriter wrapped around that
File. Only the latter of the three explicitly closed, which may have caused
the conflict to occur.
Open a PDF for writing in Acrobat, ask FOP to render that PDF and you'll
receive an error. Open it in Adobe Reader, ask FOP again, and it might work,
since the first handle on the file is read-only. (Since I tried the first
only on Windows, the latter only on Mac, this phenomenon could as well be
OS-dependent.)


Greetz,

Andreas


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Need Some Help

2005-01-05 Thread Luke Shannon
Hi;

Thanks for the response. I fixed the problem. Had the OutputStream still
opened. I responded to my previous question myself with the new functioning
code.

I guess the forum (or my mail server) is slow.

My new issue is how to render the PDF with a string input containing the
contents of the FO file.

Luke

- Original Message - 
From: "J.Pietschmann" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, January 05, 2005 6:01 PM
Subject: Re: Need Some Help


> Luke Shannon wrote:
> > When I run it in IE
> Ouch! :-)
>
> > it get a Pop up message telling me the "File does not
> > begin with '%PDF-'". This is weird to me because I am not trying to send
it
> > back through the response object, I don't know why the browser is even
> > looking at it.
>
> Does the URL which invokes the servlet end in .pdf? IEx is easily
> fooled, especially in absence of a content-type header.
>
> Try to use an URL which ends in .htm or .html, or explicitely set
> the content type to text/html, or both.
>
> J.Pietschmann
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Need Some Help

2005-01-05 Thread Luke Shannon
Responding to myself.

I have found the problem, this code below works. I am still interested if
anyone knows better way to do this.

Thanks,

Luke


/*
 * Test class to get this FOP stuff working
 */

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import org.apache.fop.apps.Driver;
import org.xml.sax.*;

/**
 * This class is intended to demonstrate submitting a FO document in memory
 * (String) to FOP and write a PDF document to the server.
 */
public class FopServlet extends HttpServlet {

public void doGet(HttpServletRequest request, HttpServletResponse
response)
throws ServletException {
try {
//the input
File fofile = new
File("D:\\applications\\fop\\fop-0.20.5\\test.fo");
//location to write to
File indexPDF = new
File("D:\\applications\\fop\\fop-0.20.5\\index.pdf");
//create an input stream from the input file
InputStream in = new FileInputStream(fofile);
//FOP Driver
Driver driver = new Driver();
//set the render type
driver.setRenderer(Driver.RENDER_PDF);
//Setup output stream
OutputStream out = new FileOutputStream(indexPDF);
out = new BufferedOutputStream(out);
//configure the input and the output
driver.setInputSource(new
InputSource("D:\\applications\\fop\\fop-0.20.5\\test.fo"));
driver.setOutputStream(out);
//run the driver
driver.run();
out.close();
PrintWriter output = response.getWriter();
output.println("Success\n"
+ "Nice Work!");
} catch (Exception ex) {
throw new ServletException(ex);
}
}
}
- Original Message - 
From: "Luke Shannon" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, January 05, 2005 4:58 PM
Subject: Need Some Help


> Hi All;
>
> Trying to get a FOP demo off the ground. The idea is an FO document comes
in
> from memory and is rendered to a PDF on the hard disk of the server.
>
> Just to get things going I am working with a FO file on the hard drive as
> well. I will tackle the contents of this file submitted in memory next.
>
> Below is my code.
>
> When I run it in IE it get a Pop up message telling me the "File does not
> begin with '%PDF-'". This is weird to me because I am not trying to send
it
> back through the response object, I don't know why the browser is even
> looking at it.
>
> When I run it in FireFox I get my success message printed, and the
document
> created. However when I trying and open it I am told there is a Sharing
> Violation. The writer was closed before I printed the success statement so
I
> am not sure where the conflict came from.
>
> Is there a better, smarter or easier way to do this? Any help would be
> appreciated.
>
> Thanks,
>
> Luke
>
> /*
>  * Test class to get this FOP stuff working
>  */
>
> import java.io.*;
> import javax.servlet.*;
> import javax.servlet.http.*;
> import org.apache.fop.apps.Driver;
> import org.xml.sax.*;
>
> /**
>  * This class is intended to demonstrate submitting a FO document in
memory
>  * (String) to FOP and write a PDF document to the server.
>  */
> public class FopServlet extends HttpServlet {
>
> public void doGet(HttpServletRequest request, HttpServletResponse
> response)
> throws ServletException {
> try {
> //the input
> File fofile = new
> File("D:\\applications\\fop\\fop-0.20.5\\test.fo");
> //location to write to
> File indexPDF = new
> File("D:\\applications\\fop\\fop-0.20.5\\index.pdf");
> //create an input stream from the input file
> InputStream in = new FileInputStream(fofile);
> //FOP Driver
> Driver driver = new Driver();
> //set the render type
> driver.setRenderer(Driver.RENDER_PDF);
> //Setup output stream
> OutputStream out = new FileOutputStream(indexPDF);
> out = new BufferedOutputStream(out);
> //configure the input and the output
> driver.setInputSource(new
> InputSource("D:\\applications\\fop\\fop-0.20.5\\test.fo"));
> driver.setOutputStream(out);
> //run the driver
> driver.run();
> //get the content
> String pdfFileContent = out.toString();
> //create the file writer
> FileWriter writer = new FileWriter(indexPDF);
> //get content into buffer
> BufferedReader br = new BufferedReader(new
> StringReader(pdfFileContent));
> //inialize a string to hold each line
> String str = "";
> //write the file
> while ((str = br.readLine()) != null) {
> writer.write(str);
> }
> //close up the writer
> writer.close();
> //write the success 

Re: Need Some Help

2005-01-05 Thread J.Pietschmann
Luke Shannon wrote:
When I run it in IE
Ouch! :-)
it get a Pop up message telling me the "File does not
begin with '%PDF-'". This is weird to me because I am not trying to send it
back through the response object, I don't know why the browser is even
looking at it.
Does the URL which invokes the servlet end in .pdf? IEx is easily
fooled, especially in absence of a content-type header.
Try to use an URL which ends in .htm or .html, or explicitely set
the content type to text/html, or both.
J.Pietschmann
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]