|
||||||||||
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
org.faceless.pdf2.viewer2.feature.PDFImporter
public class PDFImporter
A subclass of Importer
that allows PDF files to be loaded
into the viewer. This feature is essential for regular operation
of the Viewer - if not included in the list of features passed
into the PDFViewer
constructor, it will be added automatically.
To customize the list of EncryptionHandler
s used when loading a
PDF, this class can be altered. For example, to always use a specific
password when loading a PDF you could do the following.
// First, get rid of the default PDFImporter from the list Collection features = new ArrayList(ViewerFeature.getDefaultFeatures()); for (Iterator i = features.iterator();i.hasNext();) { if (i.next() instanceof PDFImporter) { i.remove(); } } // Next, create a new PDFImporter and set its EncryptionHandler PDFImporter importer = new PDFImporter(); Set handlers = importer.getEncryptionHandlers(); handlers.clear(); StandardEncryptionHandler pwhandler = new StandardEncryptionHandler(); pwhandler.setUserPassword("secret"); handlers.add(pwhandler); // Add that feature to the list and pass it into the PDFViewer features.add(importer); PDFViewer viewer = new PDFViewer(features);
useInputStream | If set to 'true' the setUseInputStream(boolean) method will be called with true as an argument. |
---|
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 |
---|
Nested classes/interfaces inherited from class org.faceless.pdf2.viewer2.Importer |
---|
Importer.ImporterTask |
Constructor Summary | |
---|---|
PDFImporter()
Create a new PDFImporter |
Method Summary | |
---|---|
Set |
getEncryptionHandlers()
Return the set of EncryptionHandler objects used to possibly decrypt
PDF files loaded with this Importer. |
FileFilter |
getFileFilter()
Get a FileFilter that can be used to choose files
acceptable to this Importer. |
Importer.ImporterTask |
getImporter(PDFViewer viewer,
File file)
Return an Importer.ImporterTask that will load a PDF into the viewer from the specifed File. |
Importer.ImporterTask |
getImporter(PDFViewer viewer,
InputStream in,
String title,
File file)
Return an Importer.ImporterTask that will load a PDF into the viewer from the specifed InputStream. |
void |
initialize(PDFViewer viewer)
Called when the feature is first added to a viewer |
boolean |
matches(File file)
Return true if this Importer can load the specified file. |
void |
setUseInputStream(boolean stream)
When opening a PDF from a File, this flag determines whether to open the PDF using the File
constructor or InputStream
PDFReader constructor. |
Methods inherited from class org.faceless.pdf2.viewer2.Importer |
---|
getImporter, getParser, processPDF |
Methods inherited from class org.faceless.pdf2.viewer2.ViewerFeature |
---|
getAllEnabledFeatures, getAllFeatures, getCustomJavaScript, getFeatureProperty, getFeatureURLProperty, getName, isEnabledByDefault, setFeatureName, teardown, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public PDFImporter()
Method Detail |
---|
public void initialize(PDFViewer viewer)
ViewerFeature
initialize
in class ViewerFeature
public FileFilter getFileFilter()
Importer
FileFilter
that can be used to choose files
acceptable to this Importer.
getFileFilter
in class Importer
public boolean matches(File file) throws IOException
Importer
file
- the File to be checked.
IOException
public Set getEncryptionHandlers()
EncryptionHandler
objects used to possibly decrypt
PDF files loaded with this Importer. This set may be altered.
public void setUseInputStream(boolean stream)
File
constructor or InputStream
PDFReader constructor.
stream
- whether to load PDF files from a FileInputStream (true) or a File (false)public Importer.ImporterTask getImporter(PDFViewer viewer, File file)
Importer
Importer.ImporterTask
that will load a PDF into the viewer from the specifed File.
getImporter
in class Importer
viewer
- the PDFViewerfile
- the FILE to load the PDF from
Importer.ImporterTask
to load the PDFpublic Importer.ImporterTask getImporter(PDFViewer viewer, InputStream in, String title, File file)
Importer
Importer.ImporterTask
that will load a PDF into the viewer from the specifed InputStream.
getImporter
in class Importer
viewer
- the PDFViewerin
- the InputStream to load the PDF fromtitle
- the title to give that PDF - may be nullfile
- if the PDF is later saved, the file to initialize the path to - may be null.
Importer.ImporterTask
to load the PDF
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |