Class FopPrintServlet
java.lang.Object
jakarta.servlet.GenericServlet
jakarta.servlet.http.HttpServlet
org.apache.fop.servlet.FopServlet
org.apache.fop.servlet.FopPrintServlet
- All Implemented Interfaces:
jakarta.servlet.Servlet, jakarta.servlet.ServletConfig, Serializable
Example servlet to generate a fop printout from a servlet.
Printing goes to the default printer on host where the servlet executes.
Servlet param is:
Example URL: http://servername/fop/servlet/FopPrintServlet?fo=readme.fo
Example URL: http://servername/fop/servlet/FopPrintServlet?xml=data.xml
Note: This servlet is derived from FopServlet. Most methods are inherited from the superclass. Only the differences to the base class are necessary.
- fo: the path to a XSL-FO file to render
- xml: the path to an XML file to render
- xslt: the path to an XSLT file that can transform the above XML to XSL-FO
Example URL: http://servername/fop/servlet/FopPrintServlet?fo=readme.fo
Example URL: http://servername/fop/servlet/FopPrintServlet?xml=data.xml
Note: This servlet is derived from FopServlet. Most methods are inherited from the superclass. Only the differences to the base class are necessary.
- See Also:
-
Field Summary
FieldsFields inherited from class FopServlet
FO_REQUEST_PARAM, fopFactory, transFactory, uriResolver, XML_REQUEST_PARAM, XSLT_REQUEST_PARAM -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidrender(Source src, Transformer transformer, jakarta.servlet.http.HttpServletResponse response) Renders an input file (XML or XSL-FO) into a PDF file.private voidreportOK(jakarta.servlet.http.HttpServletResponse response) Methods inherited from class FopServlet
configureFopFactory, convertString2Source, doGet, getFOUserAgent, init, renderFO, renderXMLMethods inherited from class jakarta.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service, serviceMethods inherited from class jakarta.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
-
Constructor Details
-
FopPrintServlet
public FopPrintServlet()
-
-
Method Details
-
render
protected void render(Source src, Transformer transformer, jakarta.servlet.http.HttpServletResponse response) throws FOPException, TransformerException, IOException Renders an input file (XML or XSL-FO) into a PDF file. It uses the JAXP transformer given to optionally transform the input document to XSL-FO. The transformer may be an identity transformer in which case the input must already be XSL-FO. The PDF is written to a byte array that is returned as the method's result.- Overrides:
renderin classFopServlet- Parameters:
src- Input XML or XSL-FOtransformer- Transformer to use for optional transformationresponse- HTTP response object- Throws:
FOPException- If an error occurs during the rendering of the XSL-FOTransformerException- If an error occurs during XSL transformationIOException- In case of an I/O problem
-
reportOK
- Throws:
IOException
-