|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.faceless.pdf2.viewer2.ViewerFeature
org.faceless.pdf2.viewer2.Importer
public abstract class Importer
A type of ViewerFeature
which takes care of loading a PDF file into
a PDFViewer
. Subclasses of this feature are supplied that can load
PDF documents directly (PDFImporter
) and by converting bitmap images
(ImageImporter
), and further custom loaders can be written.
Here's an example of how to load a PDF into the viewer from a file
PDFImporter importer = new PDFImporter(); Importer.ImporterTask task = importer.getImporter(viewer, file); task.start(viewer, "Loading");The
start
method will start a background thread and return immediately.
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.
Nested Class Summary | |
---|---|
class |
Importer.ImporterTask
This class is a LongRunningTask that can be run to load a PDF
into the viewer. |
Constructor Summary | |
---|---|
protected |
Importer(String name)
Create a new Importer |
Method Summary | |
---|---|
abstract FileFilter |
getFileFilter()
Get a FileFilter that can be used to choose files
acceptable to this Importer. |
abstract Importer.ImporterTask |
getImporter(PDFViewer viewer,
File file)
Return an Importer.ImporterTask that will load a PDF into the viewer from the specifed File. |
abstract Importer.ImporterTask |
getImporter(PDFViewer viewer,
InputStream in,
String title,
File savefile)
Return an Importer.ImporterTask that will load a PDF into the viewer from the specifed InputStream. |
Importer.ImporterTask |
getImporter(PDFViewer viewer,
URL url)
Return an Importer.ImporterTask that will load a PDF into the viewer from the specified URL. |
protected PDFParser |
getParser(PDF pdf)
Create a PDFParser for the specified PDF. |
abstract boolean |
matches(File file)
Return true if this Importer can load the specified file. |
protected void |
processPDF(PDF pdf)
Perform any processing on the PDF after it has been loaded but before it's handed off to the viewer. |
Methods inherited from class org.faceless.pdf2.viewer2.ViewerFeature |
---|
getAllEnabledFeatures, getAllFeatures, getCustomJavaScript, getFeatureProperty, getFeatureURLProperty, getName, initialize, isEnabledByDefault, setFeatureName, teardown, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
protected Importer(String name)
name
- the name of this featureMethod Detail |
---|
public abstract FileFilter getFileFilter()
FileFilter
that can be used to choose files
acceptable to this Importer.
public abstract boolean matches(File file) throws IOException
file
- the File to be checked.
IOException
public abstract Importer.ImporterTask getImporter(PDFViewer viewer, File file)
Importer.ImporterTask
that will load a PDF into the viewer from the specifed File.
viewer
- the PDFViewerfile
- the FILE to load the PDF from
Importer.ImporterTask
to load the PDFpublic abstract Importer.ImporterTask getImporter(PDFViewer viewer, InputStream in, String title, File savefile)
Importer.ImporterTask
that will load a PDF into the viewer from the specifed InputStream.
viewer
- the PDFViewerin
- the InputStream to load the PDF fromtitle
- the title to give that PDF - may be nullsavefile
- if the PDF is later saved, the file to initialize the path to - may be null.
Importer.ImporterTask
to load the PDFpublic Importer.ImporterTask getImporter(PDFViewer viewer, URL url) throws IOException
Importer.ImporterTask
that will load a PDF into the viewer from the specified URL.
viewer
- the PDFViewerurl
- the URL to load the PDF from
Importer.ImporterTask
to load the PDF
IOException
protected void processPDF(PDF pdf)
protected PDFParser getParser(PDF pdf)
PDFParser
for the specified PDF. By default
this method simply returns new PDFParser(pdf)
-
if necessary this can be overridden to return a custom subclass
of PDFParser.
pdf
- the PDF
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |