mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-06 21:00:22 +00:00
Implemented a PDF content viewer using IcePDF
This commit is contained in:
parent
0eafe1189d
commit
f0fdcca1ab
@ -72,6 +72,9 @@
|
||||
<copy file="${thirdparty.dir}/sevenzip/sevenzipjbinding.jar" todir="${ext.dir}" />
|
||||
<copy file="${thirdparty.dir}/sevenzip/sevenzipjbinding-AllPlatforms.jar" todir="${ext.dir}" />
|
||||
<copy file="${thirdparty.dir}/stix/StixLib.jar" todir="${ext.dir}" />
|
||||
<copy todir="${ext.dir}">
|
||||
<fileset dir="${thirdparty.dir}/IcePDF 6.2.2/"/>
|
||||
</copy>
|
||||
<copy file="${thirdparty.dir}/jdom/jdom-2.0.5.jar" todir="${ext.dir}" />
|
||||
<copy file="${thirdparty.dir}/jdom/jdom-2.0.5-contrib.jar" todir="${ext.dir}" />
|
||||
<copy file="${thirdparty.dir}/DatCon/3.6.9/DatCon.jar" todir="${ext.dir}" />
|
||||
|
@ -2,8 +2,15 @@ file.reference.activemq-all-5.11.1.jar=release/modules/ext/activemq-all-5.11.1.j
|
||||
file.reference.apache-mime4j-core-0.8.2.jar=release\\modules\\ext\\apache-mime4j-core-0.8.2.jar
|
||||
file.reference.apache-mime4j-dom-0.8.2.jar=release\\modules\\ext\\apache-mime4j-dom-0.8.2.jar
|
||||
file.reference.asm-7.0.jar=release\\modules\\ext\\asm-7.0.jar
|
||||
file.reference.batik-awt-util-1.6.jar=release/modules/ext/batik-awt-util-1.6.jar
|
||||
file.reference.batik-dom-1.6.jar=release/modules/ext/batik-dom-1.6.jar
|
||||
file.reference.batik-svg-dom-1.6.jar=release/modules/ext/batik-svg-dom-1.6.jar
|
||||
file.reference.batik-svggen-1.6.jar=release/modules/ext/batik-svggen-1.6.jar
|
||||
file.reference.batik-util-1.6.jar=release/modules/ext/batik-util-1.6.jar
|
||||
file.reference.batik-xml-1.6.jar=release/modules/ext/batik-xml-1.6.jar
|
||||
file.reference.bcmail-jdk15on-1.60.jar=release\\modules\\ext\\bcmail-jdk15on-1.60.jar
|
||||
file.reference.bcpkix-jdk15on-1.60.jar=release\\modules\\ext\\bcpkix-jdk15on-1.60.jar
|
||||
file.reference.bcprov-ext-jdk15on-1.54.jar=release/modules/ext/bcprov-ext-jdk15on-1.54.jar
|
||||
file.reference.bcprov-jdk15on-1.60.jar=release\\modules\\ext\\bcprov-jdk15on-1.60.jar
|
||||
file.reference.boilerpipe-1.1.0.jar=release\\modules\\ext\\boilerpipe-1.1.0.jar
|
||||
file.reference.c3p0-0.9.5.jar=release/modules/ext/c3p0-0.9.5.jar
|
||||
@ -17,14 +24,17 @@ file.reference.commons-io-2.6.jar=release\\modules\\ext\\commons-io-2.6.jar
|
||||
file.reference.commons-lang3-3.8.1.jar=release\\modules\\ext\\commons-lang3-3.8.1.jar
|
||||
file.reference.commons-pool2-2.4.2.jar=release/modules/ext/commons-pool2-2.4.2.jar
|
||||
file.reference.cxf-rt-rs-client-3.3.0.jar=release\\modules\\ext\\cxf-rt-rs-client-3.3.0.jar
|
||||
file.reference.DatCon.jar=release/modules/ext/DatCon.jar
|
||||
file.reference.dec-0.1.2.jar=release\\modules\\ext\\dec-0.1.2.jar
|
||||
file.reference.decodetect-core-0.3.jar=release\\modules\\ext\\decodetect-core-0.3.jar
|
||||
file.reference.decodetect-core-0.3.jar=release/modules/ext/decodetect-core-0.3.jar
|
||||
file.reference.fontbox-2.0.13.jar=release\\modules\\ext\\fontbox-2.0.13.jar
|
||||
file.reference.geoapi-3.0.1.jar=release\\modules\\ext\\geoapi-3.0.1.jar
|
||||
file.reference.grib-4.5.5.jar=release\\modules\\ext\\grib-4.5.5.jar
|
||||
file.reference.httpclient-4.5.6.jar=release\\modules\\ext\\httpclient-4.5.6.jar
|
||||
file.reference.httpmime-4.5.6.jar=release\\modules\\ext\\httpmime-4.5.6.jar
|
||||
file.reference.httpservices-4.5.5.jar=release\\modules\\ext\\httpservices-4.5.5.jar
|
||||
file.reference.icepdf-core-6.2.2.jar=release/modules/ext/icepdf-core-6.2.2.jar
|
||||
file.reference.icepdf-viewer-6.2.2.jar=release/modules/ext/icepdf-viewer-6.2.2.jar
|
||||
file.reference.isoparser-1.1.22.jar=release\\modules\\ext\\isoparser-1.1.22.jar
|
||||
file.reference.jackcess-2.2.0.jar=release\\modules\\ext\\jackcess-2.2.0.jar
|
||||
file.reference.jackcess-encrypt-2.1.4.jar=release\\modules\\ext\\jackcess-encrypt-2.1.4.jar
|
||||
@ -32,6 +42,8 @@ file.reference.jackson-annotations-2.9.7.jar=release\\modules\\ext\\jackson-anno
|
||||
file.reference.jackson-core-2.9.7.jar=release\\modules\\ext\\jackson-core-2.9.7.jar
|
||||
file.reference.jackson-databind-2.9.7.jar=release\\modules\\ext\\jackson-databind-2.9.7.jar
|
||||
file.reference.jai-imageio-core-1.4.0.jar=release\\modules\\ext\\jai-imageio-core-1.4.0.jar
|
||||
file.reference.jai_core-1.1.3.jar=release/modules/ext/jai_core-1.1.3.jar
|
||||
file.reference.jai_imageio-1.1.jar=release/modules/ext/jai_imageio-1.1.jar
|
||||
file.reference.java-libpst-0.8.1.jar=release\\modules\\ext\\java-libpst-0.8.1.jar
|
||||
file.reference.javax.activation-1.2.0.jar=release\\modules\\ext\\javax.activation-1.2.0.jar
|
||||
file.reference.javax.annotation-api-1.3.2.jar=release\\modules\\ext\\javax.annotation-api-1.3.2.jar
|
||||
@ -50,7 +62,7 @@ file.reference.jsoup-1.11.3.jar=release\\modules\\ext\\jsoup-1.11.3.jar
|
||||
file.reference.jul-to-slf4j-1.7.25.jar=release\\modules\\ext\\jul-to-slf4j-1.7.25.jar
|
||||
file.reference.juniversalchardet-1.0.3.jar=release\\modules\\ext\\juniversalchardet-1.0.3.jar
|
||||
file.reference.junrar-2.0.0.jar=release\\modules\\ext\\junrar-2.0.0.jar
|
||||
file.reference.jutf7-1.0.0.jar=release\\modules\\ext\\jutf7-1.0.0.jar
|
||||
file.reference.jutf7-1.0.0.jar=release/modules/ext/jutf7-1.0.0.jar
|
||||
file.reference.jxmapviewer2-2.4.jar=release/modules/ext/jxmapviewer2-2.4.jar
|
||||
file.reference.jython-standalone-2.7.0.jar=release/modules/ext/jython-standalone-2.7.0.jar
|
||||
file.reference.libphonenumber-3.5.jar=release/modules/ext/libphonenumber-3.5.jar
|
||||
|
@ -355,6 +355,14 @@
|
||||
<runtime-relative-path>ext/commons-lang3-3.8.1.jar</runtime-relative-path>
|
||||
<binary-origin>release\modules\ext\commons-lang3-3.8.1.jar</binary-origin>
|
||||
</class-path-extension>
|
||||
<class-path-extension>
|
||||
<runtime-relative-path>ext/batik-xml-1.6.jar</runtime-relative-path>
|
||||
<binary-origin>release/modules/ext/batik-xml-1.6.jar</binary-origin>
|
||||
</class-path-extension>
|
||||
<class-path-extension>
|
||||
<runtime-relative-path>ext/jai_core-1.1.3.jar</runtime-relative-path>
|
||||
<binary-origin>release/modules/ext/jai_core-1.1.3.jar</binary-origin>
|
||||
</class-path-extension>
|
||||
<class-path-extension>
|
||||
<runtime-relative-path>ext/gax-grpc-1.44.0.jar</runtime-relative-path>
|
||||
<binary-origin>release/modules/ext/gax-grpc-1.44.0.jar</binary-origin>
|
||||
@ -371,6 +379,10 @@
|
||||
<runtime-relative-path>ext/opencensus-api-0.19.2.jar</runtime-relative-path>
|
||||
<binary-origin>release/modules/ext/opencensus-api-0.19.2.jar</binary-origin>
|
||||
</class-path-extension>
|
||||
<class-path-extension>
|
||||
<runtime-relative-path>ext/batik-svg-dom-1.6.jar</runtime-relative-path>
|
||||
<binary-origin>release/modules/ext/batik-svg-dom-1.6.jar</binary-origin>
|
||||
</class-path-extension>
|
||||
<class-path-extension>
|
||||
<runtime-relative-path>ext/gax-httpjson-0.61.0.jar</runtime-relative-path>
|
||||
<binary-origin>release/modules/ext/gax-httpjson-0.61.0.jar</binary-origin>
|
||||
@ -479,6 +491,10 @@
|
||||
<runtime-relative-path>ext/xmpcore-5.1.3.jar</runtime-relative-path>
|
||||
<binary-origin>release/modules/ext/xmpcore-5.1.3.jar</binary-origin>
|
||||
</class-path-extension>
|
||||
<class-path-extension>
|
||||
<runtime-relative-path>ext/batik-util-1.6.jar</runtime-relative-path>
|
||||
<binary-origin>release/modules/ext/batik-util-1.6.jar</binary-origin>
|
||||
</class-path-extension>
|
||||
<class-path-extension>
|
||||
<runtime-relative-path>ext/javax.activation-1.2.0.jar</runtime-relative-path>
|
||||
<binary-origin>release\modules\ext\javax.activation-1.2.0.jar</binary-origin>
|
||||
@ -499,6 +515,10 @@
|
||||
<runtime-relative-path>ext/jgraphx-4.1.0.jar</runtime-relative-path>
|
||||
<binary-origin>release/modules/ext/jgraphx-4.1.0.jar</binary-origin>
|
||||
</class-path-extension>
|
||||
<class-path-extension>
|
||||
<runtime-relative-path>ext/DatCon.jar</runtime-relative-path>
|
||||
<binary-origin>release/modules/ext/DatCon.jar</binary-origin>
|
||||
</class-path-extension>
|
||||
<class-path-extension>
|
||||
<runtime-relative-path>ext/java-libpst-0.8.1.jar</runtime-relative-path>
|
||||
<binary-origin>release\modules\ext\java-libpst-0.8.1.jar</binary-origin>
|
||||
@ -535,10 +555,6 @@
|
||||
<runtime-relative-path>ext/google-http-client-1.29.0.jar</runtime-relative-path>
|
||||
<binary-origin>release/modules/ext/google-http-client-1.29.0.jar</binary-origin>
|
||||
</class-path-extension>
|
||||
<class-path-extension>
|
||||
<runtime-relative-path>ext/sleuthkit-postgresql-4.9.0.jar</runtime-relative-path>
|
||||
<binary-origin>release/modules/ext/sleuthkit-postgresql-4.9.0.jar</binary-origin>
|
||||
</class-path-extension>
|
||||
<class-path-extension>
|
||||
<runtime-relative-path>ext/bcpkix-jdk15on-1.60.jar</runtime-relative-path>
|
||||
<binary-origin>release\modules\ext\bcpkix-jdk15on-1.60.jar</binary-origin>
|
||||
@ -551,6 +567,10 @@
|
||||
<runtime-relative-path>ext/slf4j-api-1.7.25.jar</runtime-relative-path>
|
||||
<binary-origin>release\modules\ext\slf4j-api-1.7.25.jar</binary-origin>
|
||||
</class-path-extension>
|
||||
<class-path-extension>
|
||||
<runtime-relative-path>ext/bcprov-ext-jdk15on-1.54.jar</runtime-relative-path>
|
||||
<binary-origin>release/modules/ext/bcprov-ext-jdk15on-1.54.jar</binary-origin>
|
||||
</class-path-extension>
|
||||
<class-path-extension>
|
||||
<runtime-relative-path>ext/google-cloud-core-1.70.0.jar</runtime-relative-path>
|
||||
<binary-origin>release/modules/ext/google-cloud-core-1.70.0.jar</binary-origin>
|
||||
@ -619,6 +639,14 @@
|
||||
<runtime-relative-path>ext/commons-validator-1.6.jar</runtime-relative-path>
|
||||
<binary-origin>release/modules/ext/commons-validator-1.6.jar</binary-origin>
|
||||
</class-path-extension>
|
||||
<class-path-extension>
|
||||
<runtime-relative-path>ext/sleuthkit-postgresql-4.9.0.jar</runtime-relative-path>
|
||||
<binary-origin>release/modules/ext/sleuthkit-postgresql-4.9.0.jar</binary-origin>
|
||||
</class-path-extension>
|
||||
<class-path-extension>
|
||||
<runtime-relative-path>ext/decodetect-core-0.3.jar</runtime-relative-path>
|
||||
<binary-origin>release/modules/ext/decodetect-core-0.3.jar</binary-origin>
|
||||
</class-path-extension>
|
||||
<class-path-extension>
|
||||
<runtime-relative-path>ext/jbig2-imageio-3.0.2.jar</runtime-relative-path>
|
||||
<binary-origin>release\modules\ext\jbig2-imageio-3.0.2.jar</binary-origin>
|
||||
@ -667,6 +695,10 @@
|
||||
<runtime-relative-path>ext/SparseBitSet-1.1.jar</runtime-relative-path>
|
||||
<binary-origin>release/modules/ext/SparseBitSet-1.1.jar</binary-origin>
|
||||
</class-path-extension>
|
||||
<class-path-extension>
|
||||
<runtime-relative-path>ext/batik-svggen-1.6.jar</runtime-relative-path>
|
||||
<binary-origin>release/modules/ext/batik-svggen-1.6.jar</binary-origin>
|
||||
</class-path-extension>
|
||||
<class-path-extension>
|
||||
<runtime-relative-path>ext/c3p0-0.9.5.jar</runtime-relative-path>
|
||||
<binary-origin>release/modules/ext/c3p0-0.9.5.jar</binary-origin>
|
||||
@ -735,6 +767,10 @@
|
||||
<runtime-relative-path>ext/postgresql-9.4.1211.jre7.jar</runtime-relative-path>
|
||||
<binary-origin>release/modules/ext/postgresql-9.4.1211.jre7.jar</binary-origin>
|
||||
</class-path-extension>
|
||||
<class-path-extension>
|
||||
<runtime-relative-path>ext/jai_imageio-1.1.jar</runtime-relative-path>
|
||||
<binary-origin>release/modules/ext/jai_imageio-1.1.jar</binary-origin>
|
||||
</class-path-extension>
|
||||
<class-path-extension>
|
||||
<runtime-relative-path>ext/httpclient-4.5.6.jar</runtime-relative-path>
|
||||
<binary-origin>release\modules\ext\httpclient-4.5.6.jar</binary-origin>
|
||||
@ -747,6 +783,10 @@
|
||||
<runtime-relative-path>ext/fontbox-2.0.13.jar</runtime-relative-path>
|
||||
<binary-origin>release\modules\ext\fontbox-2.0.13.jar</binary-origin>
|
||||
</class-path-extension>
|
||||
<class-path-extension>
|
||||
<runtime-relative-path>ext/icepdf-core-6.2.2.jar</runtime-relative-path>
|
||||
<binary-origin>release/modules/ext/icepdf-core-6.2.2.jar</binary-origin>
|
||||
</class-path-extension>
|
||||
<class-path-extension>
|
||||
<runtime-relative-path>ext/activemq-all-5.11.1.jar</runtime-relative-path>
|
||||
<binary-origin>release/modules/ext/activemq-all-5.11.1.jar</binary-origin>
|
||||
@ -763,6 +803,10 @@
|
||||
<runtime-relative-path>ext/dec-0.1.2.jar</runtime-relative-path>
|
||||
<binary-origin>release\modules\ext\dec-0.1.2.jar</binary-origin>
|
||||
</class-path-extension>
|
||||
<class-path-extension>
|
||||
<runtime-relative-path>ext/batik-dom-1.6.jar</runtime-relative-path>
|
||||
<binary-origin>release/modules/ext/batik-dom-1.6.jar</binary-origin>
|
||||
</class-path-extension>
|
||||
<class-path-extension>
|
||||
<runtime-relative-path>ext/google-http-client-jackson2-1.29.0.jar</runtime-relative-path>
|
||||
<binary-origin>release/modules/ext/google-http-client-jackson2-1.29.0.jar</binary-origin>
|
||||
@ -779,6 +823,14 @@
|
||||
<runtime-relative-path>ext/sevenzipjbinding-AllPlatforms.jar</runtime-relative-path>
|
||||
<binary-origin>release/modules/ext/sevenzipjbinding-AllPlatforms.jar</binary-origin>
|
||||
</class-path-extension>
|
||||
<class-path-extension>
|
||||
<runtime-relative-path>ext/jutf7-1.0.0.jar</runtime-relative-path>
|
||||
<binary-origin>release/modules/ext/jutf7-1.0.0.jar</binary-origin>
|
||||
</class-path-extension>
|
||||
<class-path-extension>
|
||||
<runtime-relative-path>ext/batik-awt-util-1.6.jar</runtime-relative-path>
|
||||
<binary-origin>release/modules/ext/batik-awt-util-1.6.jar</binary-origin>
|
||||
</class-path-extension>
|
||||
<class-path-extension>
|
||||
<runtime-relative-path>ext/google-api-services-translate-v2-rev20170525-1.27.0.jar</runtime-relative-path>
|
||||
<binary-origin>release/modules/ext/google-api-services-translate-v2-rev20170525-1.27.0.jar</binary-origin>
|
||||
@ -787,6 +839,10 @@
|
||||
<runtime-relative-path>ext/webp-imageio-sejda-0.1.0.jar</runtime-relative-path>
|
||||
<binary-origin>release/modules/ext/webp-imageio-sejda-0.1.0.jar</binary-origin>
|
||||
</class-path-extension>
|
||||
<class-path-extension>
|
||||
<runtime-relative-path>ext/icepdf-viewer-6.2.2.jar</runtime-relative-path>
|
||||
<binary-origin>release/modules/ext/icepdf-viewer-6.2.2.jar</binary-origin>
|
||||
</class-path-extension>
|
||||
<class-path-extension>
|
||||
<runtime-relative-path>ext/bcmail-jdk15on-1.60.jar</runtime-relative-path>
|
||||
<binary-origin>release\modules\ext\bcmail-jdk15on-1.60.jar</binary-origin>
|
||||
@ -795,18 +851,6 @@
|
||||
<runtime-relative-path>ext/vorbis-java-tika-0.8.jar</runtime-relative-path>
|
||||
<binary-origin>release\modules\ext\vorbis-java-tika-0.8.jar</binary-origin>
|
||||
</class-path-extension>
|
||||
<class-path-extension>
|
||||
<runtime-relative-path>ext/decodetect-core-0.3.jar</runtime-relative-path>
|
||||
<binary-origin>release/modules/ext/decodetect-core-0.3.jar</binary-origin>
|
||||
</class-path-extension>
|
||||
<class-path-extension>
|
||||
<runtime-relative-path>ext/jutf7-1.0.0.jar</runtime-relative-path>
|
||||
<binary-origin>release/modules/ext/jutf7-1.0.0.jar</binary-origin>
|
||||
</class-path-extension>
|
||||
<class-path-extension>
|
||||
<runtime-relative-path>ext/DatCon.jar</runtime-relative-path>
|
||||
<binary-origin>release/modules/ext/DatCon.jar</binary-origin>
|
||||
</class-path-extension>
|
||||
</data>
|
||||
</configuration>
|
||||
</project>
|
||||
|
@ -112,6 +112,8 @@ MessageContentViewer.attachmentsPanel.TabConstraints.tabTitle=Attachments
|
||||
MessageContentViewer.viewInNewWindowButton.text=View in New Window
|
||||
JPEGViewerDummy.jLabel1.text=You are looking at a JPEG file:
|
||||
JPEGViewerDummy.jTextField1.text=jTextField1
|
||||
PDFViewer.encryptedDialog=This document is password protected.
|
||||
PDFViewer.errorDialog=Error occurred while opening this PDF document. Check the logs for more information. You may continue to use this feature on other PDF documents.
|
||||
PListNode.KeyCol=Key
|
||||
PListNode.TypeCol=Type
|
||||
PListNode.ValueCol=Value
|
||||
|
@ -50,7 +50,8 @@ public class FileViewer extends javax.swing.JPanel implements DataContentViewer
|
||||
new PListViewer(),
|
||||
new MediaFileViewer(),
|
||||
new HtmlViewer(),
|
||||
new WindowsRegistryViewer()
|
||||
new WindowsRegistryViewer(),
|
||||
new PDFViewer()
|
||||
};
|
||||
|
||||
private FileTypeViewer lastViewer;
|
||||
|
193
Core/src/org/sleuthkit/autopsy/contentviewers/PDFViewer.java
Executable file
193
Core/src/org/sleuthkit/autopsy/contentviewers/PDFViewer.java
Executable file
@ -0,0 +1,193 @@
|
||||
/*
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
* Copyright 2020 Basis Technology Corp.
|
||||
* Contact: carrier <at> sleuthkit <dot> org
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.sleuthkit.autopsy.contentviewers;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Component;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.ResourceBundle;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.logging.Level;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.SwingWorker;
|
||||
|
||||
import org.openide.util.NbBundle;
|
||||
|
||||
import org.sleuthkit.datamodel.AbstractFile;
|
||||
import org.sleuthkit.datamodel.ReadContentInputStream;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
|
||||
|
||||
import org.icepdf.core.exceptions.PDFException;
|
||||
import org.icepdf.core.exceptions.PDFSecurityException;
|
||||
import org.icepdf.core.pobjects.Document;
|
||||
|
||||
import org.icepdf.ri.common.ComponentKeyBinding;
|
||||
import org.icepdf.ri.common.SwingController;
|
||||
import org.icepdf.ri.common.SwingViewBuilder;
|
||||
import org.icepdf.ri.common.views.DocumentViewControllerImpl;
|
||||
import org.icepdf.ri.common.views.DocumentViewModelImpl;
|
||||
import org.icepdf.ri.util.PropertiesManager;
|
||||
|
||||
/**
|
||||
* Application content viewer for PDF files.
|
||||
*/
|
||||
public class PDFViewer implements FileTypeViewer {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(PDFViewer.class.getName());
|
||||
|
||||
private JPanel container;
|
||||
private final PropertiesManager propsManager;
|
||||
private final ResourceBundle defaultMessageBundle;
|
||||
|
||||
public PDFViewer() {
|
||||
container = createNewContainer();
|
||||
propsManager = getCustomProperties();
|
||||
defaultMessageBundle = ResourceBundle.getBundle(PropertiesManager.DEFAULT_MESSAGE_BUNDLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getSupportedMIMETypes() {
|
||||
return Arrays.asList("application/pdf");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFile(AbstractFile file) {
|
||||
// The 'C' in IcePDFs MVC set up.
|
||||
SwingController controller = new SwingController();
|
||||
|
||||
// Builder for the 'V' in IcePDFs MVC set up
|
||||
SwingViewBuilder viewBuilder = new SwingViewBuilder(controller, propsManager);
|
||||
|
||||
// The 'V' in IcePDFs MVC set up.
|
||||
JPanel icePdfPanel = viewBuilder.buildViewerPanel();
|
||||
|
||||
// This connects keyboard commands performed on the view to the controller.
|
||||
// The only keyboard commands that the controller supports is Ctrl-C for
|
||||
// copying selected text.
|
||||
ComponentKeyBinding.install(controller, icePdfPanel);
|
||||
|
||||
// Ensure the preferredSize is in sync with the parent container.
|
||||
icePdfPanel.setPreferredSize(this.container.getPreferredSize());
|
||||
|
||||
// Add the IcePDF view to the center of our container.
|
||||
this.container.add(icePdfPanel, BorderLayout.CENTER);
|
||||
|
||||
// Document is the 'M' in IcePDFs MVC set up. Read the data needed to
|
||||
// populate the model in the background.
|
||||
new SwingWorker<Document, Void>() {
|
||||
@Override
|
||||
protected Document doInBackground() throws PDFException, PDFSecurityException, IOException {
|
||||
ReadContentInputStream stream = new ReadContentInputStream(file);
|
||||
Document doc = new Document();
|
||||
// This will read the stream into memory.
|
||||
doc.setInputStream(stream, null);
|
||||
return doc;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void done() {
|
||||
// Customize the view selection modes on the EDT. Each of these
|
||||
// will cause UI widgets to be updated.
|
||||
try {
|
||||
Document doc = get();
|
||||
controller.openDocument(doc, null);
|
||||
// This makes the PDF viewer appear as one continuous
|
||||
// document, which is the default for most popular PDF viewers.
|
||||
controller.setPageViewMode(DocumentViewControllerImpl.ONE_COLUMN_VIEW, true);
|
||||
// This makes it possible to select text by left clicking and dragging.
|
||||
controller.setDisplayTool(DocumentViewModelImpl.DISPLAY_TOOL_TEXT_SELECTION);
|
||||
} catch (InterruptedException ex) {
|
||||
// Do nothing.
|
||||
} catch (ExecutionException ex) {
|
||||
Throwable exCause = ex.getCause();
|
||||
if (exCause instanceof PDFSecurityException) {
|
||||
showEncryptionDialog();
|
||||
} else {
|
||||
logger.log(Level.WARNING, String.format("PDF content viewer "
|
||||
+ "was unable to open document with id %d and name %s",
|
||||
file.getId(), file.getName()), ex);
|
||||
showErrorDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
}.execute();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component getComponent() {
|
||||
return container;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetComponent() {
|
||||
container = createNewContainer();
|
||||
}
|
||||
|
||||
// The container should have a BorderLayout otherwise the IcePDF panel may
|
||||
// not be visible.
|
||||
private JPanel createNewContainer() {
|
||||
return new JPanel(new BorderLayout());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSupported(AbstractFile file) {
|
||||
return getSupportedMIMETypes().contains(file.getMIMEType());
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets property values that will control how the view will be constructed
|
||||
* in IcePDFs MVC set up.
|
||||
*/
|
||||
private PropertiesManager getCustomProperties() {
|
||||
Properties props = new Properties();
|
||||
|
||||
// See link for available properties. https://www.icesoft.org/wiki/display/PDF/Customizing+the+Viewer
|
||||
props.setProperty(PropertiesManager.PROPERTY_SHOW_UTILITY_SAVE, "false");
|
||||
props.setProperty(PropertiesManager.PROPERTY_SHOW_UTILITY_OPEN, "false");
|
||||
props.setProperty(PropertiesManager.PROPERTY_SHOW_UTILITY_PRINT, "false");
|
||||
props.setProperty(PropertiesManager.PROPERTY_SHOW_TOOLBAR_ANNOTATION, "false");
|
||||
props.setProperty(PropertiesManager.PROPERTY_SHOW_UTILITYPANE_ANNOTATION, "false");
|
||||
|
||||
// This suppresses a pop-up, from IcePDF, that asks if you'd like to
|
||||
// save configuration changes to disk.
|
||||
props.setProperty("application.showLocalStorageDialogs", "false");
|
||||
|
||||
return new PropertiesManager(System.getProperties(), props, defaultMessageBundle);
|
||||
}
|
||||
|
||||
@NbBundle.Messages({
|
||||
"PDFViewer.errorDialog=An error occurred while opening this PDF document. "
|
||||
+ "Check the logs for more information. You may continue to use "
|
||||
+ "this feature on other PDF documents."
|
||||
})
|
||||
private void showErrorDialog() {
|
||||
MessageNotifyUtil.Message.error(Bundle.PDFViewer_errorDialog());
|
||||
}
|
||||
|
||||
@NbBundle.Messages({
|
||||
"PDFViewer.encryptedDialog=This document is password protected."
|
||||
})
|
||||
private void showEncryptionDialog() {
|
||||
MessageNotifyUtil.Message.error(Bundle.PDFViewer_encryptedDialog());
|
||||
}
|
||||
}
|
BIN
thirdparty/IcePDF 6.2.2/batik-awt-util-1.6.jar
vendored
Executable file
BIN
thirdparty/IcePDF 6.2.2/batik-awt-util-1.6.jar
vendored
Executable file
Binary file not shown.
BIN
thirdparty/IcePDF 6.2.2/batik-dom-1.6.jar
vendored
Executable file
BIN
thirdparty/IcePDF 6.2.2/batik-dom-1.6.jar
vendored
Executable file
Binary file not shown.
BIN
thirdparty/IcePDF 6.2.2/batik-svg-dom-1.6.jar
vendored
Executable file
BIN
thirdparty/IcePDF 6.2.2/batik-svg-dom-1.6.jar
vendored
Executable file
Binary file not shown.
BIN
thirdparty/IcePDF 6.2.2/batik-svggen-1.6.jar
vendored
Executable file
BIN
thirdparty/IcePDF 6.2.2/batik-svggen-1.6.jar
vendored
Executable file
Binary file not shown.
BIN
thirdparty/IcePDF 6.2.2/batik-util-1.6.jar
vendored
Executable file
BIN
thirdparty/IcePDF 6.2.2/batik-util-1.6.jar
vendored
Executable file
Binary file not shown.
BIN
thirdparty/IcePDF 6.2.2/batik-xml-1.6.jar
vendored
Executable file
BIN
thirdparty/IcePDF 6.2.2/batik-xml-1.6.jar
vendored
Executable file
Binary file not shown.
BIN
thirdparty/IcePDF 6.2.2/bcpkix-jdk15on-1.54.jar
vendored
Executable file
BIN
thirdparty/IcePDF 6.2.2/bcpkix-jdk15on-1.54.jar
vendored
Executable file
Binary file not shown.
BIN
thirdparty/IcePDF 6.2.2/bcprov-ext-jdk15on-1.54.jar
vendored
Executable file
BIN
thirdparty/IcePDF 6.2.2/bcprov-ext-jdk15on-1.54.jar
vendored
Executable file
Binary file not shown.
BIN
thirdparty/IcePDF 6.2.2/bcprov-jdk15on-1.54.jar
vendored
Executable file
BIN
thirdparty/IcePDF 6.2.2/bcprov-jdk15on-1.54.jar
vendored
Executable file
Binary file not shown.
BIN
thirdparty/IcePDF 6.2.2/icepdf-core-6.2.2.jar
vendored
Executable file
BIN
thirdparty/IcePDF 6.2.2/icepdf-core-6.2.2.jar
vendored
Executable file
Binary file not shown.
BIN
thirdparty/IcePDF 6.2.2/icepdf-viewer-6.2.2.jar
vendored
Executable file
BIN
thirdparty/IcePDF 6.2.2/icepdf-viewer-6.2.2.jar
vendored
Executable file
Binary file not shown.
BIN
thirdparty/IcePDF 6.2.2/jai_core-1.1.3.jar
vendored
Executable file
BIN
thirdparty/IcePDF 6.2.2/jai_core-1.1.3.jar
vendored
Executable file
Binary file not shown.
BIN
thirdparty/IcePDF 6.2.2/jai_imageio-1.1.jar
vendored
Executable file
BIN
thirdparty/IcePDF 6.2.2/jai_imageio-1.1.jar
vendored
Executable file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user