Userconfig.xml for FOP within an applet.
As you might know I have successfully got the Japanese fonts to be displayed on PDF by using the userconfig.xml file to load the MSGOTHIC.TTF fonts. In this case I was running a servlet which used FOP to convert the XML file on the webserver ( weblogic) to PDF and then open it using acrobat. I want to do the same thing within an applet. A few months back I could use FOP within an applet to convert XML residing on the server to PDF and then send the resulting PDF to the printqueue on the clients default printer. This works perfectly. Now my question is I want FOP within the applet to recognize Japanese character sets. My approach is to have the userconfig.xml, msgothic.ttf and msgothic.xml ( font metrics ) files in the same jar file as the Applet itself. Would this work? Can I just load the userconfig.xml file from the jar file using the classloader and then call FOP ? I will be trying this next week and just wanted to know your opinion. ThanksManoj
Re: Printing PDF on the client default printer.
This is how I did it.. 1) I used a invisible signed applet within the jsp page which renders the screen. 2) The user selects the documents to be printed and passes this info to the applet. 3) The applet take this info and calls a servlet which creates the corresponding XMLs. 4) The XSLTHandler within the applet then renders the pdf to the default printer on the client side. The XSLT input handler takes in the XSD and the created XML as its parameter during instanciation.. Sorry to be short as i am busy here but can get in detail if reqd.. Thanks Manoj "Charles Ohana" <[EMAIL PROTECTED]To: <[EMAIL PROTECTED]> rp.com> cc: Subject: Re: Printing PDF on the client default printer. 11/30/2004 12:19 PM Please respond to fop-dev wow!!! sounds great... Where can we get that ??? Thanx. - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Tuesday, November 30, 2004 9:02 AM Subject: Printing PDF on the client default printer. Just wanted everyone to know that I have successfully implemented client side printing using FOP Eg: If the XML file gets created on the webserver which is located in Los Angeles and the user in London, then the XML is converted to PDF and the PDF file is printed on the clients default printer in London. Thanks Manoj -Forwarded by Manoj Nair/LA/SPE on 11/30/2004 09:00AM - To: [EMAIL PROTECTED] From: [EMAIL PROTECTED] Date: 10/21/2004 10:13AM Subject: Printing PDF on the client default printer. ** I had posted this in the fop-user group and the responses indicated that there is no way this can be implemented currently. Just wanted an opinion from the fop-dev crowd. Thanks ** My requirement is to render an XML as a PDF and then print the PDF on the clients default printer. I dont want the PDF to prompt user to open the acrobat reader. I already have an applet on the client side which uses PrinterJob class to popup the printer selection box on client side. Now how do I redirect the content from server to this printer? Should I use Driver.RENDER_PRINT / Driver.RENDER_PCL set in the fop driver renderer ? and what content type should the response object return? Thanks Manoj PS: I have successfully use the FopPrinter example ( FopPrintServlet ) to print pdfs on the app servers default printer but what I need is to be able to print on the clients default printer and not on servers printer.
Printing PDF on the client default printer.
Just wanted everyone to know that I have successfully implemented client side printing using FOP Eg: If the XML file gets created on the webserver which is located in Los Angeles and the user in London, then the XML is converted to PDF and the PDF file is printed on the clients default printer in London. ThanksManoj -Forwarded by Manoj Nair/LA/SPE on 11/30/2004 09:00AM -To: [EMAIL PROTECTED]From: [EMAIL PROTECTED]Date: 10/21/2004 10:13AMSubject: Printing PDF on the client default printer.**I had posted this in the fop-user group and the responses indicated thatthere is no way this can be implemented currently. Just wanted an opinionfrom the fop-dev crowd.Thanks**My requirement is to render an XML as a PDF and then print the PDF on theclients default printer. I dont want the PDF to prompt user to open theacrobat reader.I already have an applet on the client side which uses PrinterJob class topopup the printer selection box on client side.Now how do I redirect the content from server to this printer?Should I use Driver.RENDER_PRINT / Driver.RENDER_PCL set in the fop driverrenderer ? and what content type should the response object return?ThanksManojPS: I have successfully use the FopPrinter example ( FopPrintServlet ) toprint pdfs on the app servers default printer but what I need is to be ableto print on the clients default printer and not on servers printer.
XSLTInputHandler questions
Folks I am planning to use the following XSLTInputHandler constructor in an applet downloaded on the client side. Before I use it I have the following questions. public XSLTInputHandler(File xmlfile, File xsltfile) throws FOPException { } public XSLTInputHandler(String xmlURL, String xsltURL) throws FOPException { } public XSLTInputHandler(InputSource xmlSource, InputSource xsltSource) throws FOPException { } 1) Would a URL constructor passed as string like new XSLTInputHandler (new String(http://host:7011/web/myXML.xml";), new String(http://host:7011/web/myXSL.xsl";)) work ? 2) I read on some websites that org.apache.fop.apps.XSLTInputHandler(InputSource ,InputSource ) constructor doesnt work for InputSource and can only be used for String and File arguments? Have anyone made it work with InputSource arguments? 3) As the XSLTInputHandler is called on client side I want to read the XSL and XML files from app server. How should I go about reading the XSL,XML files from server? as inputstreams? Thanks Manoj
Printing PDF on the client default printer.
** I had posted this in the fop-user group and the responses indicated that there is no way this can be implemented currently. Just wanted an opinion from the fop-dev crowd. Thanks ** My requirement is to render an XML as a PDF and then print the PDF on the clients default printer. I dont want the PDF to prompt user to open the acrobat reader. I already have an applet on the client side which uses PrinterJob class to popup the printer selection box on client side. Now how do I redirect the content from server to this printer? Should I use Driver.RENDER_PRINT / Driver.RENDER_PCL set in the fop driver renderer ? and what content type should the response object return? Thanks Manoj PS: I have successfully use the FopPrinter example ( FopPrintServlet ) to print pdfs on the app servers default printer but what I need is to be able to print on the clients default printer and not on servers printer.
How to tell Driver to open acrobat in a new IE?
I am parsing my XML file through FOP parser and then telling the driver to render it as PDF. The process is initiated by clicking on a button on IE. What happens is the current IE instance opens the acrobat and displays the PDF it. The users have to hit back button to get back to the application. My question is how do i tell the Driver to open the PDF in a separate instance of acrobat (within a new IE instance) or just by acrobat independently. Thanks Manoj My sample code is below public void renderXML(XSLTInputHandler input, HttpServletResponse response) throws ServletException { try { ByteArrayOutputStream out = new ByteArrayOutputStream(); response.setContentType(CONTENT_TYPE); Driver driver = new Driver(); String OS = System.getProperty("os.name"); driver.setLogger(log); driver.setErrorDump(true); driver.setRenderer(Driver.RENDER_PDF); driver.setOutputStream(out); driver.render(input.getParser(), input.getInputSource()); byte[] content = out.toByteArray(); response.setContentLength(content.length); response.getOutputStream().write(content); response.getOutputStream().flush(); } catch (Exception ex) { throw new ServletException(ex); } }
XMLParser error with unicode characters in XML file.
I am getting a XML parsing error from weblogic.apache.xerces when I parse a XML document which contains accented characters. This is what I am doing 1) Some database columns have accented data for spanish,japanese etc languages like NÃmero de identificaÃÃo: and nÃmero de identificaciÃn. 2) I am reading this data and creating a XML file using some processing and then writing the file on the disc using weblogic.xml.stream.XMLOutputStream flush() method. 3) Then I am using FOP to render this XML in PDF. In the rendering process the weblogic.apache.xerces.XMLparser gets called to parse the XML. Here the parser throws a org.xml.sax.SAXParserException ( An invalid XML character (Unicode: 0xfa) was found in the element content of the document). I was under the impression that XMLParser should take care of the accented characters. When I open the XML file which I created in XML SPY I see "box" characters like "cliente nï de identificaciò". Please let me know how should i handle my code here. Thanks Manoj Thanks
Accessing File in a WAR for XSLTInputHandler
My application is deployed in a WAR format on Unix. The XSLTInputHandler is trying to access the XSL and the XML files on the system but the getRealPath() and the getResource() methods return null /or a path which included the war info and the XSLTInputHandler errors out with FileNotFoundException. The XSLTInputHandler constructor with InputSource and String doesnt work ( its a bug and I dont see it being fixed as per bugzilla). So my question is how do i get the File objects for XSL and XML from a WARred setup? Thanks