Skip to content
This repository has been archived by the owner on Jan 23, 2020. It is now read-only.

Commit

Permalink
iText RUPS 5.5.8
Browse files Browse the repository at this point in the history
  • Loading branch information
amedee committed Nov 27, 2015
2 parents 66fa533 + 7a15122 commit 8bcbef9
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 4 deletions.
12 changes: 10 additions & 2 deletions BUILDING.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
Building RUPS
-------------

Running a maven build without profile will just build the jar.
Install a recent JDK, [Maven], and type:

Running the build with profiles:
```
mvn install
```

Running a maven build without a profile will just build the jar.

Running the build with profiles (`-P profile`):

profile name | build actions
------------ | -------------
all | generate jar, jar with dependencies in it, sources jar, javadoc jar
exe | create a windows exe to run RUPS

[maven]: http://maven.apache.org/
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<groupId>com.itextpdf</groupId>
<artifactId>itext-rups</artifactId>
<name>itext-rups</name>
<version>5.5.7</version>
<version>5.5.8</version>
<description>Rups, a tool to view PDF structure in a swing gui.</description>
<url>http://www.itextpdf.com/</url>
<mailingLists>
Expand Down Expand Up @@ -226,7 +226,7 @@
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itextpdf</artifactId>
<version>5.5.7</version>
<version>5.5.8</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
package com.itextpdf.rups.view.contextmenu;

import com.itextpdf.rups.view.itext.PdfTree;
import com.itextpdf.rups.view.itext.SyntaxHighlightedStreamPane;
import com.itextpdf.rups.view.itext.treenodes.PdfObjectTreeNode;
import com.itextpdf.text.pdf.PdfObject;

import javax.swing.AbstractAction;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.KeyStroke;

import java.awt.Component;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;

/**
* @author Michael Demey
*/
public class InspectObjectAction extends AbstractRupsAction {

private Component invoker;

public InspectObjectAction(String name, Component invoker) {
super(name);
this.invoker = invoker;
}

@Override
public void actionPerformed(ActionEvent e) {
final JFrame frame = new JFrame("Rups Object Inspection Window");

// defines the size and location
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
frame.setSize((int)(screen.getWidth() * .70), (int)(screen.getHeight() * .70));
frame.setLocation((int)(screen.getWidth() * .05), (int)(screen.getHeight() * .05));
frame.setResizable(true);

frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

final PdfObject pdfObject = ( (PdfObjectTreeNode) ( (PdfTree) invoker ).getSelectionPath().getLastPathComponent() ).getPdfObject();
final SyntaxHighlightedStreamPane syntaxHighlightedStreamPane = new SyntaxHighlightedStreamPane();

frame.add(syntaxHighlightedStreamPane);
syntaxHighlightedStreamPane.render(pdfObject);

frame.getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "Cancel");
frame.getRootPane().getActionMap().put("Cancel", new AbstractAction() {
public void actionPerformed(ActionEvent e) {
frame.dispose();
}
});

if ( e.getSource() instanceof Component ) {
frame.setLocationRelativeTo((Component) e.getSource());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ public class PdfTreeContextMenu {

public static JPopupMenu getPopupMenu(final Component component) {
JPopupMenu popup = new JPopupMenu();

JMenuItem inspect = new JMenuItem();
inspect.setText("Inspect Object");
inspect.setAction(new InspectObjectAction("Inspect Object", component));
popup.add(inspect);

JMenuItem saveRawToFile = new JMenuItem();
saveRawToFile.setText("Save Raw Bytes to File");
saveRawToFile.setAction(new SaveToFilePdfTreeAction("Save Raw Bytes to File", component, true));
Expand Down

0 comments on commit 8bcbef9

Please sign in to comment.