public abstract class Exporter extends ViewerFeature
ViewerFeature
which allows PDF's to be saved in a variety of formats.
It's chiefly used with the Save
widget, although it can be
used in other contexts if necessary.
This code is copyright the Big Faceless Organization. You're welcome to use, modify and distribute it in any form in your own projects, provided those projects continue to make use of the Big Faceless PDF library.
Modifier and Type | Class and Description |
---|---|
class |
Exporter.ExporterTask
This class is a
LongRunningTask that can be run to save a PDF to
an OutputStream. |
Constructor and Description |
---|
Exporter(String name)
Create a new Exporter
|
Modifier and Type | Method and Description |
---|---|
void |
completed()
Called when the save has completed - by default, a no-op.
|
JComponent |
getComponent()
Deprecated.
Subclasses should override
getComponent(DocumentPanel,File) instead |
JComponent |
getComponent(DocumentPanel panel,
File file)
Return a JComponent which prompts the user for additional information after
the initial save dialog.
|
abstract Exporter.ExporterTask |
getExporter(DocumentPanel panel,
PDF pdf,
JComponent component,
OutputStream out)
Return a new
Exporter.ExporterTask that would save a PDF |
abstract FileFilter |
getFileFilter()
Get a FileFilter that matches the Files output by this Exporter
|
abstract String |
getFileSuffix()
Return the suffix of files normally output by this Exporter, such
as "pdf", "tif", "jpg" etc.
|
boolean |
isEnabled(DocumentPanel docpanel)
Return true if this Exporter should be available for this DocumentPanel.
|
void |
postProcessPDF(PDF pdf)
Called by
Exporter.ExporterTask.savePDF() just after the PDF is saved,
you can override this method for custom processing. |
void |
preProcessPDF(PDF pdf)
Called by
Exporter.ExporterTask.savePDF() just before the PDF is saved,
you can override this method for custom processing. |
String |
validateComponent(JComponent comp)
Given the component returned by
getComponent(org.faceless.pdf2.viewer2.DocumentPanel, java.io.File) , return null
if the values are valid or an error message if they're invalid. |
getAllEnabledFeatures, getAllFeatures, getCustomJavaScript, getFeatureProperty, getFeatureURLProperty, getName, initialize, isEnabledByDefault, setFeatureName, teardown, toString
public Exporter(String name)
name
- the name of the featurepublic abstract FileFilter getFileFilter()
public abstract String getFileSuffix()
public boolean isEnabled(DocumentPanel docpanel)
public abstract Exporter.ExporterTask getExporter(DocumentPanel panel, PDF pdf, JComponent component, OutputStream out)
Exporter.ExporterTask
that would save a PDFpanel
- the DocumentPanel this PDF is being saved from - may be nullpdf
- the PDF being saves (not null)component
- the JComponent returned by getComponent(org.faceless.pdf2.viewer2.DocumentPanel, java.io.File)
out
- the OutputStream to write the PDF topublic JComponent getComponent(DocumentPanel panel, File file)
Return a JComponent which prompts the user for additional information after
the initial save dialog. An example might be when saving to a bitmap format -
this component could prompt for image resolution and so on. If this method
returns null
(the default), then no additional component will
be displayed on save.
By default this method calls return getComponent()
, which calls
the legacy method which was the recommended approach prior to 2.15.1
panel
- the DocumentPanel containing the PDF being savedfile
- the File being saved to@Deprecated public JComponent getComponent()
getComponent(DocumentPanel,File)
insteadgetComponent(DocumentPanel, File)
, but this method takes no DocumentPanel
and File arguments. Subclasses should override the getComponent(DocumentPanel,File)
method instead.public String validateComponent(JComponent comp)
getComponent(org.faceless.pdf2.viewer2.DocumentPanel, java.io.File)
, return null
if the values are valid or an error message if they're invalid.comp
- the Component returned by getComponent(org.faceless.pdf2.viewer2.DocumentPanel, java.io.File)
public void preProcessPDF(PDF pdf)
Exporter.ExporterTask.savePDF()
just before the PDF is saved,
you can override this method for custom processing. By default
it's a no-oppublic void postProcessPDF(PDF pdf)
Exporter.ExporterTask.savePDF()
just after the PDF is saved,
you can override this method for custom processing. By default
it's a no-oppublic void completed()
Exporter.ExporterTask.completed()
method in
the Exporter.ExporterTask
will be called on completion, and
subclasses can override either.Copyright © 2001-2017 Big Faceless Organization