Skip to content

Commit 4293ad7

Browse files
Show MCID information in structure tree panel
- Extract text and/or ActualText from marked content - Jump to content stream/form XObject - Display ActualText on structure elements that have it RES-683
1 parent b12ccc2 commit 4293ad7

File tree

12 files changed

+1199
-103
lines changed

12 files changed

+1199
-103
lines changed
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
/*
2+
This file is part of the iText (R) project.
3+
Copyright (c) 1998-2022 iText Group NV
4+
Authors: iText Software.
5+
6+
This program is free software; you can redistribute it and/or modify
7+
it under the terms of the GNU Affero General Public License version 3
8+
as published by the Free Software Foundation with the addition of the
9+
following permission added to Section 15 as permitted in Section 7(a):
10+
FOR ANY PART OF THE COVERED WORK IN WHICH THE COPYRIGHT IS OWNED BY
11+
ITEXT GROUP. ITEXT GROUP DISCLAIMS THE WARRANTY OF NON INFRINGEMENT
12+
OF THIRD PARTY RIGHTS
13+
14+
This program is distributed in the hope that it will be useful, but
15+
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16+
or FITNESS FOR A PARTICULAR PURPOSE.
17+
See the GNU Affero General Public License for more details.
18+
You should have received a copy of the GNU Affero General Public License
19+
along with this program; if not, see http://www.gnu.org/licenses or write to
20+
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21+
Boston, MA, 02110-1301 USA, or download the license from the following URL:
22+
http://itextpdf.com/terms-of-use/
23+
24+
The interactive user interfaces in modified source and object code versions
25+
of this program must display Appropriate Legal Notices, as required under
26+
Section 5 of the GNU Affero General Public License.
27+
28+
In accordance with Section 7(b) of the GNU Affero General Public License,
29+
a covered work must retain the producer line in every PDF that is created
30+
or manipulated using iText.
31+
32+
You can be released from the requirements of the license by purchasing
33+
a commercial license. Buying such a license is mandatory as soon as you
34+
develop commercial activities involving the iText software without
35+
disclosing the source code of your own applications.
36+
These activities include: offering paid services to customers as an ASP,
37+
serving PDFs on the fly in a web application, shipping iText with a closed
38+
source product.
39+
40+
For more information, please contact iText Software Corp. at this
41+
42+
*/
43+
package com.itextpdf.rups.model;
44+
45+
/**
46+
* Interface for an informational dialog window showing the progress of a certain action.
47+
*/
48+
public interface IProgressDialog {
49+
/**
50+
* Changes the message describing what's in progress.
51+
*
52+
* @param msg the message describing what's in progress
53+
*/
54+
void setMessage(String msg);
55+
56+
/**
57+
* Changes the value of the progress bar.
58+
*
59+
* @param value the current value
60+
*/
61+
void setValue(int value);
62+
63+
/**
64+
* Sets the maximum value for the progress bar.
65+
* If 0 or less, sets the progress bar to indeterminate mode.
66+
*
67+
* @param n the maximum value for the progress bar
68+
*/
69+
void setTotal(int n);
70+
71+
/**
72+
* Displays an error dialog for the given exception.
73+
*
74+
* @param ex exception to display information about
75+
*/
76+
void showErrorDialog(Exception ex);
77+
78+
/**
79+
* Control the visibility of the progress dialog.
80+
*
81+
* @param visible visibility status of the dialog
82+
*/
83+
void setVisible(boolean visible);
84+
}

src/main/java/com/itextpdf/rups/model/ObjectLoader.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ This file is part of the iText (R) project.
4545
import com.itextpdf.rups.event.PostOpenDocumentEvent;
4646
import com.itextpdf.rups.view.Language;
4747

48-
import javax.swing.SwingUtilities;
4948
import java.util.Observer;
49+
import javax.swing.SwingUtilities;
5050

5151
/**
5252
* Loads the necessary iText PDF objects in Background.
@@ -73,7 +73,7 @@ public class ObjectLoader extends BackgroundTask {
7373
*/
7474
private final String loaderName;
7575

76-
private final ProgressDialog progress;
76+
private final IProgressDialog progress;
7777

7878
/**
7979
* Creates a new ObjectLoader.
@@ -83,7 +83,7 @@ public class ObjectLoader extends BackgroundTask {
8383
* @param observer the object that will forward the changes.
8484
* @param file the PdfFile from which the objects will be read.
8585
*/
86-
public ObjectLoader(Observer observer, PdfFile file, String loaderName, ProgressDialog progress) {
86+
public ObjectLoader(Observer observer, PdfFile file, String loaderName, IProgressDialog progress) {
8787
this.observer = observer;
8888
this.file = file;
8989
this.loaderName = loaderName;
@@ -151,7 +151,7 @@ public void finished() {
151151
try {
152152
observer.update(null, new PostOpenDocumentEvent(this));
153153
} catch (Exception ex) {
154-
ErrorDialogPane.showErrorDialog(progress, ex);
154+
progress.showErrorDialog(ex);
155155
LoggerHelper.error(ex.getLocalizedMessage(), ex, getClass());
156156
}
157157
progress.setVisible(false);

src/main/java/com/itextpdf/rups/model/ProgressDialog.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ This file is part of the iText (R) project.
5959
/**
6060
* An informational dialog window showing the progress of a certain action.
6161
*/
62-
public final class ProgressDialog extends JDialog {
62+
public final class ProgressDialog extends JDialog implements IProgressDialog {
6363
/**
6464
* label showing the message describing what's in progress.
6565
*/
@@ -125,6 +125,7 @@ public void dispose() {
125125
*
126126
* @param msg the message describing what's in progress
127127
*/
128+
@Override
128129
public void setMessage(String msg) {
129130
message.setText(msg);
130131
}
@@ -134,6 +135,7 @@ public void setMessage(String msg) {
134135
*
135136
* @param value the current value
136137
*/
138+
@Override
137139
public void setValue(int value) {
138140
progress.setValue(value);
139141
}
@@ -144,6 +146,7 @@ public void setValue(int value) {
144146
*
145147
* @param n the maximum value for the progress bar
146148
*/
149+
@Override
147150
public void setTotal(int n) {
148151
if (n > 0) {
149152
progress.setMaximum(n);
@@ -154,4 +157,14 @@ public void setTotal(int n) {
154157
progress.setStringPainted(false);
155158
}
156159
}
160+
161+
/**
162+
* Displays an error dialog for the given exception.
163+
*
164+
* @param ex exception to display information about
165+
*/
166+
@Override
167+
public void showErrorDialog(Exception ex) {
168+
ErrorDialogPane.showErrorDialog(this, ex);
169+
}
157170
}

0 commit comments

Comments
 (0)