|
|||||||||
| Home >> All >> org >> javahispano >> canyamo >> services >> presentation >> [ xml overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.javahispano.canyamo.services.presentation.xml
Class PDFTransformer

java.lang.Objectorg.javahispano.canyamo.services.presentation.xml.PDFTransformer
- public class PDFTransformer
- extends java.lang.Object
This class transforms XML files to PDF using XSL stylesheets. It's a singleton so only one instance will be created in the virtual machine. This transformer can ouput the transformation result as files or as an OuputStream. This second option typically will be used to redirect PDF output to a browse via response object.
This class initally doesn't support Xalan sources ( DOMSource, SAXSource ) but adding this support is mostly trival and will be similar to HTMLTransformer
This class supports the concept of stylesheet templates. You can use the createTemplate methods for storing stylesheets within the HTMLTransformer cache. These stylesheets will be reused each time so the overall performance increases. Here is a simple example of using PDF Transformer in a servlet:
PDFTransformer pdfTransformer = PDFTransformer.newInstance();
OutputStream out = response.getOutputStream();
pdfTransformer.transformToFile("article.xml","article.xsl",out);
If you would like to generate a file instead of using an output stream
PDFTransformer pdfTransformer = PDFTransformer.newInstance();
OutputStream out = response.getOutputStream();
pdfTransformer.transform("article.xml","article.xsl","article.pdf");
- Version:
- 1.0
| Field Summary | |
private static HTMLTransformer |
htmlTransformer
Description of the Field |
private static PDFTransformer |
singleton
Description of the Field |
| Constructor Summary | |
private |
PDFTransformer()
Constructor |
| Method Summary | |
void |
createTemplates(javax.xml.transform.Source source)
This method creates a template from a source stylesheet so the styleshhet can be reused. |
void |
createTemplates(java.lang.String source)
This method creates a template from a source stylesheet so the styleshhet can be reused. |
static PDFTransformer |
newInstance()
PDFTransformer will be a singleton object. |
void |
transform(java.lang.String xmlSource,
java.lang.String xslSource,
java.io.OutputStream out)
Transforms an XML source into a PDF using an XSL source. |
void |
transformToFile(java.lang.String xmlSource,
java.lang.String xslSource,
java.lang.String file)
Transforms an XML source into a PDF using an XSL source. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
singleton
private static PDFTransformer singleton
- Description of the Field
htmlTransformer
private static HTMLTransformer htmlTransformer
- Description of the Field
| Constructor Detail |
PDFTransformer
private PDFTransformer()
- Constructor
| Method Detail |
newInstance
public static PDFTransformer newInstance()
- PDFTransformer will be a singleton object. This methods return
the unique instance of this class and creates it if necessary
createTemplates
public void createTemplates(java.lang.String source) throws TransformerException
- This method creates a template from a source stylesheet so
the styleshhet can be reused.
Typically will be used from within a document management system to store the common stylesheets (articles, news, etc.) used to transform documents.
Using this method ensures that stylesheets will be reused between transformations
createTemplates
public void createTemplates(javax.xml.transform.Source source) throws TransformerException
- This method creates a template from a source stylesheet so
the styleshhet can be reused.
Typically will be used from within a document management system to store the common stylesheets (articles, news, etc.) used to transform documents.
Using this method ensures that stylesheets will be reused between transformations
transform
public void transform(java.lang.String xmlSource, java.lang.String xslSource, java.io.OutputStream out) throws TransformerException
- Transforms an XML source into a PDF using an XSL source. The PDF
is stored in the OuputStream specified. This can be util for example
for redirecting a PDF file via Servlet's response object
transformToFile
public void transformToFile(java.lang.String xmlSource, java.lang.String xslSource, java.lang.String file) throws TransformerException
- Transforms an XML source into a PDF using an XSL source. The PDF
is stored in the specified file.
|
|||||||||
| Home >> All >> org >> javahispano >> canyamo >> services >> presentation >> [ xml overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
org.javahispano.canyamo.services.presentation.xml.PDFTransformer