|
||||||||||
| 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 EncryptionHandlers 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);
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. |
| Methods inherited from class org.faceless.pdf2.viewer2.Importer |
|---|
getImporter |
| Methods inherited from class org.faceless.pdf2.viewer2.ViewerFeature |
|---|
getAllFeatures, getName, 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 ViewerFeaturepublic FileFilter getFileFilter()
ImporterFileFilter that can be used to choose files
acceptable to this Importer.
getFileFilter in class Importer
public boolean matches(File file)
throws IOException
Importer
matches in class Importerfile - the File to be checked.
IOExceptionpublic Set getEncryptionHandlers()
EncryptionHandler objects used to possibly decrypt
PDF files loaded with this Importer. This set may be altered.
public Importer.ImporterTask getImporter(PDFViewer viewer,
File file)
ImporterImporter.ImporterTask that will load a PDF into the viewer from the specifed File.
getImporter in class Importerviewer - the PDFViewerfile - the FILE to load the PDF from
Importer.ImporterTask to load the PDF
public Importer.ImporterTask getImporter(PDFViewer viewer,
InputStream in,
String title,
File file)
ImporterImporter.ImporterTask that will load a PDF into the viewer from the specifed InputStream.
getImporter in class Importerviewer - 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 | |||||||||