public class PdfExportImpl extends Object implements PdfExport
PdfExport.ExportType
Constructor and Description |
---|
PdfExportImpl() |
Modifier and Type | Method and Description |
---|---|
protected String |
applyXSLT(String xml,
InputStream xslt)
Applies an XSLT transformation to an XML document.
|
void |
export(XWikiDocument doc,
OutputStream out,
PdfExport.ExportType type,
XWikiContext context)
Export a wiki Document into PDF or RTF.
|
void |
exportHtml(String html,
OutputStream out,
PdfExport.ExportType type,
XWikiContext context)
Convert an HTML document to PDF.
|
void |
exportToPDF(XWikiDocument doc,
OutputStream out,
XWikiContext context)
Export a wiki Document into PDF.
|
protected void |
exportXHTML(String xhtml,
OutputStream out,
PdfExport.ExportType type,
XWikiContext context)
Convert a valid XHTML document into PDF.
|
protected InputStream |
getXslt(String propertyName,
String fallbackFile,
XWikiContext context)
Get an XSLT file.
|
public void exportToPDF(XWikiDocument doc, OutputStream out, XWikiContext context) throws XWikiException
PdfExport
PdfExport.export(XWikiDocument, OutputStream, ExportType, XWikiContext)
for more details about the
conversion process.exportToPDF
in interface PdfExport
doc
- the document to exportout
- where to write the resulting documentcontext
- the current request contextXWikiException
- if the conversion fails for any reasonPdfExport.export(XWikiDocument, OutputStream, ExportType, XWikiContext)
public void export(XWikiDocument doc, OutputStream out, PdfExport.ExportType type, XWikiContext context) throws XWikiException
PdfExport
pdf.vm
template, the resulting HTML is cleaned up into valid XHTML, and custom CSS is applied to it. The
XHTML document is transformed into an XSL-FO document, which is finally processed using Apache FOP.export
in interface PdfExport
doc
- the document to exportout
- where to write the resulting documenttype
- the type of the output: PDF or RTFcontext
- the current request contextXWikiException
- if the conversion fails for any reasonpublic void exportHtml(String html, OutputStream out, PdfExport.ExportType type, XWikiContext context) throws XWikiException
PdfExport
exportHtml
in interface PdfExport
html
- the source document to transformout
- where to write the resulting documenttype
- the type of the output: PDF or RTFcontext
- the current request contextXWikiException
- if the conversion fails for any reasonprotected void exportXHTML(String xhtml, OutputStream out, PdfExport.ExportType type, XWikiContext context) throws XWikiException
Note: This method is protected just allow other exporters to hook their code and use the PDF export infrastructure. This is just a temporary solution. The PDF export code needs to be redesigned because it has parts than can be reused for other export formats.
xhtml
- the source document to transformout
- where to write the resulting documenttype
- the type of the output: PDF or RTFcontext
- the current request contextXWikiException
- if the conversion fails for any reasonprotected String applyXSLT(String xml, InputStream xslt) throws XWikiException
xml
- the XML document to convertxslt
- the XSLT to applyXWikiException
- if the transformation fails for any reasonprotected InputStream getXslt(String propertyName, String fallbackFile, XWikiContext context)
propertyName
- the name of the xproperty from which to read the XSLT file.
See getPDFTemplateProperty(String, XWikiContext)
for details on how this property
is resolved. If the property doesn't point to any XSLT file then the fallback file parameter
is used insteadfallbackFile
- the name of a resource file to use when no XSLT content was found using the passed
propertyName
context
- the current request contextCopyright © 2004–2022 XWiki. All rights reserved.