Hello

Excuse me for a give-me-a-ride question.
Can Font Metric msmincho.xml be refered in this Luke's FopServlet?

tts6
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

>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("<html><head><title>Success</title></head>\n"
+ "<body><h1>Nice Work!</h1></body></html>");
} 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

_________________________________________________________________
無料250MBメールボックスのMSN Hotmail https://registernet.passport.net/reg.srf?id=2&lc=1041

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

Reply via email to