aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/lowagie/tools/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/lowagie/tools/plugins')
-rw-r--r--src/main/java/com/lowagie/tools/plugins/AbstractTool.java341
-rw-r--r--src/main/java/com/lowagie/tools/plugins/Bookmarks2XML.java148
-rw-r--r--src/main/java/com/lowagie/tools/plugins/Burst.java140
-rw-r--r--src/main/java/com/lowagie/tools/plugins/Concat.java185
-rw-r--r--src/main/java/com/lowagie/tools/plugins/Decrypt.java148
-rw-r--r--src/main/java/com/lowagie/tools/plugins/DvdCover.java201
-rw-r--r--src/main/java/com/lowagie/tools/plugins/Encrypt.java193
-rw-r--r--src/main/java/com/lowagie/tools/plugins/ExtractAttachments.java227
-rw-r--r--src/main/java/com/lowagie/tools/plugins/Handouts.java232
-rw-r--r--src/main/java/com/lowagie/tools/plugins/HtmlBookmarks.java288
-rw-r--r--src/main/java/com/lowagie/tools/plugins/ImageXRefViewer.java256
-rw-r--r--src/main/java/com/lowagie/tools/plugins/InspectPDF.java173
-rw-r--r--src/main/java/com/lowagie/tools/plugins/KnitTiff.java178
-rw-r--r--src/main/java/com/lowagie/tools/plugins/LPRClient.java245
-rw-r--r--src/main/java/com/lowagie/tools/plugins/NUp.java165
-rw-r--r--src/main/java/com/lowagie/tools/plugins/PhotoAlbum.java200
-rw-r--r--src/main/java/com/lowagie/tools/plugins/RemoveLaunchApplication.java189
-rw-r--r--src/main/java/com/lowagie/tools/plugins/ReversePages.java180
-rw-r--r--src/main/java/com/lowagie/tools/plugins/SelectedPages.java150
-rw-r--r--src/main/java/com/lowagie/tools/plugins/Split.java168
-rw-r--r--src/main/java/com/lowagie/tools/plugins/Tiff2Pdf.java192
-rw-r--r--src/main/java/com/lowagie/tools/plugins/TreeViewPDF.java160
-rw-r--r--src/main/java/com/lowagie/tools/plugins/Txt2Pdf.java169
-rw-r--r--src/main/java/com/lowagie/tools/plugins/Watermarker.java163
-rw-r--r--src/main/java/com/lowagie/tools/plugins/XML2Bookmarks.java156
-rw-r--r--src/main/java/com/lowagie/tools/plugins/treeview/AnalyzePDF.java507
-rw-r--r--src/main/java/com/lowagie/tools/plugins/treeview/ArrayTreeNode.java107
-rw-r--r--src/main/java/com/lowagie/tools/plugins/treeview/DictionaryTreeNode.java112
-rw-r--r--src/main/java/com/lowagie/tools/plugins/treeview/FileTreeNode.java86
-rw-r--r--src/main/java/com/lowagie/tools/plugins/treeview/ICommonAnalyzer.java79
-rw-r--r--src/main/java/com/lowagie/tools/plugins/treeview/IUpdatenodeview.java59
-rw-r--r--src/main/java/com/lowagie/tools/plugins/treeview/OutlinelistTreeNode.java98
-rw-r--r--src/main/java/com/lowagie/tools/plugins/treeview/PagelistTreeNode.java87
-rw-r--r--src/main/java/com/lowagie/tools/plugins/treeview/Pagetreenode.java208
-rw-r--r--src/main/java/com/lowagie/tools/plugins/treeview/ProgressDialog.java124
-rw-r--r--src/main/java/com/lowagie/tools/plugins/treeview/SimpletextTreeNode.java69
-rw-r--r--src/main/java/com/lowagie/tools/plugins/treeview/TextpaneTreeNode.java91
-rw-r--r--src/main/java/com/lowagie/tools/plugins/treeview/TreeViewInternalFrame.java272
-rw-r--r--src/main/java/com/lowagie/tools/plugins/treeview/UpdateableTreeNode.java74
39 files changed, 0 insertions, 6820 deletions
diff --git a/src/main/java/com/lowagie/tools/plugins/AbstractTool.java b/src/main/java/com/lowagie/tools/plugins/AbstractTool.java
deleted file mode 100644
index 5e57892..0000000
--- a/src/main/java/com/lowagie/tools/plugins/AbstractTool.java
+++ /dev/null
@@ -1,341 +0,0 @@
-/*
- * $Id: AbstractTool.java,v 1.10 2006/05/30 09:13:19 blowagie Exp $
- * $Name: $
- *
- * Copyright 2005 by Bruno Lowagie.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (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.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.tools.plugins;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.KeyEvent;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import javax.swing.JInternalFrame;
-import javax.swing.JMenu;
-import javax.swing.JMenuBar;
-import javax.swing.JMenuItem;
-import javax.swing.JOptionPane;
-
-import com.lowagie.tools.Executable;
-import com.lowagie.tools.ToolMenuItems;
-import com.lowagie.tools.arguments.ToolArgument;
-
-/**
- * Every iText tool has to implement this interface.
- */
-public abstract class AbstractTool implements ToolMenuItems, ActionListener {
-
- /** An array with the versions of the tool. */
- public static ArrayList versionsarray = new ArrayList();
-
- /** The internal frame of the tool. */
- protected JInternalFrame internalFrame = null;
- /** The list of arguments needed by the tool. */
- protected ArrayList arguments = new ArrayList();
- /** Execute menu options */
- protected int menuoptions = MENU_EXECUTE;
- /** a menu option */
- public static final int MENU_EXECUTE = 1;
- /** a menu option */
- public static final int MENU_EXECUTE_SHOW = 2;
- /** a menu option */
- public static final int MENU_EXECUTE_PRINT = 4;
- /** a menu option */
- public static final int MENU_EXECUTE_PRINT_SILENT = 8;
-
- /**
- * Sets the arguments.
- * @param arguments The arguments to set.
- */
- public void setArguments(ArrayList arguments) {
- this.arguments = arguments;
- }
-
- /**
- * Sets the arguments.
- * @param args the arguments as String-array.
- */
- public void setArguments(String[] args) {
- int counter = 0;
- ToolArgument argument;
- for (Iterator i = arguments.iterator(); i.hasNext(); ) {
- argument = (ToolArgument) i.next();
- if (args.length > counter) {
- argument.setValue(args[counter]);
- }
- else {
- break;
- }
- counter++;
- }
- }
-
- /**
- * Gets the arguments.
- * @return Returns the arguments.
- */
- public ArrayList getArguments() {
- return arguments;
- }
-
- /**
- * Gets the value of a given argument.
- * @param name the name of the argument
- * @return the value of an argument as an Object.
- * @throws InstantiationException
- */
- public Object getValue(String name) throws InstantiationException {
- ToolArgument argument;
- for (Iterator i = arguments.iterator(); i.hasNext(); ) {
- argument = (ToolArgument) i.next();
- if (name.equals(argument.getName())) {
- return argument.getArgument();
- }
- }
- return null;
- }
-
- /**
- * Sets the internal frame.
- * @param internalFrame The internalFrame to set.
- */
- public void setInternalFrame(JInternalFrame internalFrame) {
- this.internalFrame = internalFrame;
- }
-
- /**
- * Returns the internal frame. Creates one if it's null.
- * @return Returns the internalFrame.
- */
- public JInternalFrame getInternalFrame() {
- if (internalFrame == null) {
- createFrame();
- }
- return internalFrame;
- }
-
- /**
- * Gets the menubar.
- * @return a menubar for this tool
- */
- public JMenuBar getMenubar() {
- JMenuBar menubar = new JMenuBar();
- JMenu tool = new JMenu(TOOL);
- tool.setMnemonic(KeyEvent.VK_F);
- JMenuItem usage = new JMenuItem(USAGE);
- usage.setMnemonic(KeyEvent.VK_U);
- usage.addActionListener(this);
- tool.add(usage);
- JMenuItem args = new JMenuItem(ARGUMENTS);
- args.setMnemonic(KeyEvent.VK_A);
- args.addActionListener(this);
- tool.add(args);
- if ((menuoptions & MENU_EXECUTE) > 0) {
- JMenuItem execute = new JMenuItem(EXECUTE);
- execute.setMnemonic(KeyEvent.VK_E);
- execute.addActionListener(this);
- tool.add(execute);
- }
- if ((menuoptions & MENU_EXECUTE_SHOW) > 0) {
- JMenuItem execute = new JMenuItem(EXECUTESHOW);
- execute.addActionListener(this);
- tool.add(execute);
- }
- if ((menuoptions & MENU_EXECUTE_PRINT) > 0) {
- JMenuItem execute = new JMenuItem(EXECUTEPRINT);
- execute.addActionListener(this);
- tool.add(execute);
- }
- if ((menuoptions & MENU_EXECUTE_PRINT_SILENT) > 0) {
- JMenuItem execute = new JMenuItem(EXECUTEPRINTSILENT);
- execute.addActionListener(this);
- tool.add(execute);
- }
- JMenuItem close = new JMenuItem(CLOSE);
- close.setMnemonic(KeyEvent.VK_C);
- close.addActionListener(this);
- tool.add(close);
- menubar.add(tool);
- if (arguments.size() > 0) {
- JMenu params = new JMenu(ARGUMENTS);
- tool.setMnemonic(KeyEvent.VK_T);
- JMenuItem item;
- ToolArgument argument;
- for (Iterator i = arguments.iterator(); i.hasNext(); ) {
- argument = (ToolArgument)i.next();
- item = new JMenuItem(argument.getName());
- item.setToolTipText(argument.getDescription());
- item.addActionListener(argument);
- params.add(item);
- }
- menubar.add(params);
- }
- return menubar;
- }
-
- /**
- * Gets the usage of the tool.
- * @return a String describing how to use the tool.
- */
- public String getUsage() {
- StringBuffer buf = new StringBuffer("java ");
- buf.append(getClass().getName());
- ToolArgument argument;
- for (Iterator i = arguments.iterator(); i.hasNext(); ) {
- argument = (ToolArgument) i.next();
- buf.append(" ");
- buf.append(argument.getName());
- }
- buf.append("\n");
- for (Iterator i = arguments.iterator(); i.hasNext(); ) {
- argument = (ToolArgument) i.next();
- buf.append(argument.getUsage());
- }
- return buf.toString();
- }
-
- /**
- * Gets the current arguments of the tool.
- * @return a String with the list of arguments and their values.
- */
- public String getArgs() {
- StringBuffer buf = new StringBuffer("Current arguments:\n");
- ToolArgument argument;
- for (Iterator i = arguments.iterator(); i.hasNext(); ) {
- argument = (ToolArgument) i.next();
- buf.append(" ");
- buf.append(argument.getName());
- if (argument.getValue() == null) {
- buf.append(" = null\n");
- }
- else {
- buf.append(" = '");
- buf.append(argument.getValue());
- buf.append("'\n");
- }
- }
- return buf.toString();
- }
-
- /**
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- */
- public void actionPerformed(ActionEvent evt) {
- if (CLOSE.equals(evt.getActionCommand())) {
- System.out.println("=== " + getInternalFrame().getTitle() + " CLOSED ===");
- internalFrame.dispose();
- }
- if (USAGE.equals(evt.getActionCommand())) {
- JOptionPane.showMessageDialog(internalFrame, getUsage());
- }
- if (ARGUMENTS.equals(evt.getActionCommand())) {
- JOptionPane.showMessageDialog(internalFrame, getArgs());
- }
- if (EXECUTE.equals(evt.getActionCommand())) {
- this.execute();
- }
- if (EXECUTESHOW.equals(evt.getActionCommand())) {
- this.execute();
- try {
- Executable.openDocument(getDestPathPDF());
- } catch (Exception e) {
- System.err.println(e.getMessage());
- }
- }
- if (EXECUTEPRINT.equals(evt.getActionCommand())) {
- this.execute();
- try {
- Executable.printDocument(getDestPathPDF());
- } catch (Exception e) {
- System.err.println(e.getMessage());
- }
- }
- if (EXECUTEPRINTSILENT.equals(evt.getActionCommand())) {
- this.execute();
- try {
- Executable.printDocumentSilent(getDestPathPDF());
- } catch (Exception e) {
- System.err.println(e.getMessage());
- }
- }
- }
-
- /**
- * Gets the PDF file that should be generated (or null if the output isn't a PDF file).
- * @return the PDF file that should be generated
- * @throws InstantiationException
- */
- protected abstract File getDestPathPDF() throws InstantiationException;
-
- /**
- * Creates the internal frame.
- */
- protected abstract void createFrame();
-
- /**
- * Executes the tool (in most cases this generates a PDF file).
- */
- public abstract void execute();
-
- /**
- * Indicates that the value of an argument has changed.
- * @param arg the argument that has changed
- */
- public abstract void valueHasChanged(ToolArgument arg);
-
- /**
- * Add the version of the plugin to the versions array.
- * @param version the version to add.
- */
- protected static void addVersion(String version) {
- version = version.substring(5, version.length() - 7);
- version = version.substring(0, version.lastIndexOf(" "));
- versionsarray.add(version);
- }
-}
diff --git a/src/main/java/com/lowagie/tools/plugins/Bookmarks2XML.java b/src/main/java/com/lowagie/tools/plugins/Bookmarks2XML.java
deleted file mode 100644
index 444a775..0000000
--- a/src/main/java/com/lowagie/tools/plugins/Bookmarks2XML.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * $Id: Bookmarks2XML.java,v 1.1 2006/02/02 15:56:53 blowagie Exp $
- * $Name: $
- *
- * Copyright 2005 by Hans-Werner Hilse.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (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.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.tools.plugins;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.util.List;
-
-import javax.swing.JInternalFrame;
-import javax.swing.JOptionPane;
-
-import com.lowagie.text.pdf.PdfReader;
-import com.lowagie.text.pdf.SimpleBookmark;
-import com.lowagie.tools.arguments.FileArgument;
-import com.lowagie.tools.arguments.PdfFilter;
-import com.lowagie.tools.arguments.ToolArgument;
-
-/**
- * Allows you to add bookmarks to an existing PDF file
- */
-public class Bookmarks2XML extends AbstractTool {
-
- static {
- addVersion("$Id: Bookmarks2XML.java,v 1.1 2006/02/02 15:56:53 blowagie Exp $");
- }
-
- /**
- * Constructs an Bookmarks2XML object.
- */
- public Bookmarks2XML() {
- arguments.add(new FileArgument(this, "pdffile", "the PDF from which you want to extract bookmarks", false, new PdfFilter()));
- arguments.add(new FileArgument(this, "xmlfile", "the resulting bookmarks file in XML", true));
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#createFrame()
- */
- protected void createFrame() {
- internalFrame = new JInternalFrame("Bookmarks2XML", true, true, true);
- internalFrame.setSize(300, 80);
- internalFrame.setJMenuBar(getMenubar());
- System.out.println("=== Bookmarks2XML OPENED ===");
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#execute()
- */
- public void execute() {
- try {
- if (getValue("xmlfile") == null) throw new InstantiationException("You need to choose an xml file");
- if (getValue("pdffile") == null) throw new InstantiationException("You need to choose a source PDF file");
- PdfReader reader = new PdfReader(((File)getValue("pdffile")).getAbsolutePath());
- reader.consolidateNamedDestinations();
- List bookmarks = SimpleBookmark.getBookmark( reader );
- // save them in XML format
- FileOutputStream bmWriter = new FileOutputStream( (File)getValue("xmlfile") );
- SimpleBookmark.exportToXML(bookmarks, bmWriter, "UTF-8", false);
- bmWriter.close();
- }
- catch(Exception e) {
- e.printStackTrace();
- JOptionPane.showMessageDialog(internalFrame,
- e.getMessage(),
- e.getClass().getName(),
- JOptionPane.ERROR_MESSAGE);
- System.err.println(e.getMessage());
- }
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#valueHasChanged(com.lowagie.tools.arguments.ToolArgument)
- */
- public void valueHasChanged(ToolArgument arg) {
- if (internalFrame == null) {
- // if the internal frame is null, the tool was called from the commandline
- return;
- }
- // represent the changes of the argument in the internal frame
- }
-
- /**
- * Allows you to generate an index file in HTML containing Bookmarks to an existing PDF file.
- * @param args
- */
- public static void main(String[] args) {
- Bookmarks2XML tool = new Bookmarks2XML();
- if (args.length < 2) {
- System.err.println(tool.getUsage());
- }
- tool.setArguments(args);
- tool.execute();
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#getDestPathPDF()
- */
- protected File getDestPathPDF() throws InstantiationException {
- throw new InstantiationException("There is no file to show.");
- }
-
-}
diff --git a/src/main/java/com/lowagie/tools/plugins/Burst.java b/src/main/java/com/lowagie/tools/plugins/Burst.java
deleted file mode 100644
index 1aca12a..0000000
--- a/src/main/java/com/lowagie/tools/plugins/Burst.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * $Id: Burst.java,v 1.8 2005/11/29 21:05:02 blowagie Exp $
- * $Name: $
- *
- * This code is free software. It may only be copied or modified
- * if you include the following copyright notice:
- *
- * This class by Mark Thompson. Copyright (c) 2002 Mark Thompson.
- *
- * This code is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * itext-questions@list.sourceforge.net
- */
-package com.lowagie.tools.plugins;
-
-import java.io.File;
-import java.io.FileOutputStream;
-
-import javax.swing.JInternalFrame;
-
-import com.lowagie.text.Document;
-import com.lowagie.text.pdf.PdfContentByte;
-import com.lowagie.text.pdf.PdfImportedPage;
-import com.lowagie.text.pdf.PdfReader;
-import com.lowagie.text.pdf.PdfWriter;
-import com.lowagie.tools.arguments.FileArgument;
-import com.lowagie.tools.arguments.LabelAccessory;
-import com.lowagie.tools.arguments.PdfFilter;
-import com.lowagie.tools.arguments.ToolArgument;
-
-/**
- * This tool lets you split a PDF in several separate PDF files (1 per page).
- */
-public class Burst extends AbstractTool {
-
- static {
- addVersion("$Id: Burst.java,v 1.8 2005/11/29 21:05:02 blowagie Exp $");
- }
-
- /**
- * Constructs a Burst object.
- */
- public Burst() {
- FileArgument f = new FileArgument(this, "srcfile", "The file you want to split", false, new PdfFilter());
- f.setLabel(new LabelAccessory());
- arguments.add(f);
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#createFrame()
- */
- protected void createFrame() {
- internalFrame = new JInternalFrame("Burst", true, false, true);
- internalFrame.setSize(300, 80);
- internalFrame.setJMenuBar(getMenubar());
- System.out.println("=== Burst OPENED ===");
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#execute()
- */
- public void execute() {
- try {
- if (getValue("srcfile") == null) throw new InstantiationException("You need to choose a sourcefile");
- File src = (File)getValue("srcfile");
- File directory = src.getParentFile();
- String name = src.getName();
- name = name.substring(0, name.lastIndexOf("."));
- // we create a reader for a certain document
- PdfReader reader = new PdfReader(src.getAbsolutePath());
- // we retrieve the total number of pages
- int n = reader.getNumberOfPages();
- int digits = 1 + (n / 10);
- System.out.println("There are " + n + " pages in the original file.");
- Document document;
- int pagenumber;
- String filename;
- for (int i = 0; i < n; i++) {
- pagenumber = i + 1;
- filename = String.valueOf(pagenumber);
- while (filename.length() < digits) filename = "0" + filename;
- filename = "_" + filename + ".pdf";
- // step 1: creation of a document-object
- document = new Document(reader.getPageSizeWithRotation(pagenumber));
- // step 2: we create a writer that listens to the document
- PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(new File(directory, name + filename)));
- // step 3: we open the document
- document.open();
- PdfContentByte cb = writer.getDirectContent();
- PdfImportedPage page = writer.getImportedPage(reader, pagenumber);
- int rotation = reader.getPageRotation(pagenumber);
- if (rotation == 90 || rotation == 270) {
- cb.addTemplate(page, 0, -1f, 1f, 0, 0, reader.getPageSizeWithRotation(pagenumber).height());
- }
- else {
- cb.addTemplate(page, 1f, 0, 0, 1f, 0, 0);
- }
- // step 5: we close the document
- document.close();
- }
- }
- catch(Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#valueHasChanged(com.lowagie.tools.arguments.ToolArgument)
- */
- public void valueHasChanged(ToolArgument arg) {
- if (internalFrame == null) {
- // if the internal frame is null, the tool was called from the commandline
- return;
- }
- // represent the changes of the argument in the internal frame
- }
-
-
- /**
- * Divide PDF file into pages.
- * @param args
- */
- public static void main(String[] args) {
- Burst tool = new Burst();
- if (args.length < 1) {
- System.err.println(tool.getUsage());
- }
- tool.setArguments(args);
- tool.execute();
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#getDestPathPDF()
- */
- protected File getDestPathPDF() throws InstantiationException {
- throw new InstantiationException("There is more than one destfile.");
- }
-}
diff --git a/src/main/java/com/lowagie/tools/plugins/Concat.java b/src/main/java/com/lowagie/tools/plugins/Concat.java
deleted file mode 100644
index b6eb369..0000000
--- a/src/main/java/com/lowagie/tools/plugins/Concat.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * $Id: Concat.java,v 1.7 2005/11/29 21:05:02 blowagie Exp $
- * $Name: $
- *
- * Copyright 2005 by Bruno Lowagie.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (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.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.tools.plugins;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.swing.JInternalFrame;
-
-import com.lowagie.text.Document;
-import com.lowagie.text.pdf.PdfCopy;
-import com.lowagie.text.pdf.PdfImportedPage;
-import com.lowagie.text.pdf.PdfReader;
-import com.lowagie.text.pdf.SimpleBookmark;
-import com.lowagie.tools.arguments.FileArgument;
-import com.lowagie.tools.arguments.PdfFilter;
-import com.lowagie.tools.arguments.ToolArgument;
-
-/**
- * Concatenates two PDF files
- */
-public class Concat extends AbstractTool {
-
- static {
- addVersion("$Id: Concat.java,v 1.7 2005/11/29 21:05:02 blowagie Exp $");
- }
- /**
- * Constructs a Concat object.
- */
- public Concat() {
- menuoptions = MENU_EXECUTE | MENU_EXECUTE_SHOW;
- arguments.add(new FileArgument(this, "srcfile1", "The first PDF file", false, new PdfFilter()));
- arguments.add(new FileArgument(this, "srcfile2", "The second PDF file", false, new PdfFilter()));
- arguments.add(new FileArgument(this, "destfile", "The file to which the concatenated PDF has to be written", true, new PdfFilter()));
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#createFrame()
- */
- protected void createFrame() {
- internalFrame = new JInternalFrame("Concatenate 2 PDF files", true, false, true);
- internalFrame.setSize(300, 80);
- internalFrame.setJMenuBar(getMenubar());
- System.out.println("=== Concat OPENED ===");
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#execute()
- */
- public void execute() {
- try {
- String[] files = new String[2];
- if (getValue("srcfile1") == null) throw new InstantiationException("You need to choose a first sourcefile");
- files[0] = ((File)getValue("srcfile1")).getAbsolutePath();
- if (getValue("srcfile2") == null) throw new InstantiationException("You need to choose a second sourcefile");
- files[1] = ((File)getValue("srcfile2")).getAbsolutePath();
- if (getValue("destfile") == null) throw new InstantiationException("You need to choose a destination file");
- File pdf_file = (File)getValue("destfile");
- int pageOffset = 0;
- ArrayList master = new ArrayList();
- Document document = null;
- PdfCopy writer = null;
- for (int i = 0; i < 2; i++) {
- // we create a reader for a certain document
- PdfReader reader = new PdfReader(files[i]);
- reader.consolidateNamedDestinations();
- // we retrieve the total number of pages
- int n = reader.getNumberOfPages();
- List bookmarks = SimpleBookmark.getBookmark(reader);
- if (bookmarks != null) {
- if (pageOffset != 0)
- SimpleBookmark.shiftPageNumbers(bookmarks, pageOffset, null);
- master.addAll(bookmarks);
- }
- pageOffset += n;
- System.out.println("There are " + n + " pages in " + files[i]);
- if (i == 0) {
- // step 1: creation of a document-object
- document = new Document(reader.getPageSizeWithRotation(1));
- // step 2: we create a writer that listens to the document
- writer = new PdfCopy(document, new FileOutputStream(pdf_file));
- // step 3: we open the document
- document.open();
- }
- // step 4: we add content
- PdfImportedPage page;
- for (int p = 0; p < n; ) {
- ++p;
- page = writer.getImportedPage(reader, p);
- writer.addPage(page);
- System.out.println("Processed page " + p);
- }
- }
- if (master.size() > 0)
- writer.setOutlines(master);
- // step 5: we close the document
- document.close();
- }
- catch(Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#valueHasChanged(com.lowagie.tools.arguments.ToolArgument)
- */
- public void valueHasChanged(ToolArgument arg) {
- if (internalFrame == null) {
- // if the internal frame is null, the tool was called from the commandline
- return;
- }
- // represent the changes of the argument in the internal frame
- }
-
-
- /**
- * Concatenates two PDF files.
- * @param args
- */
- public static void main(String[] args) {
- Concat tool = new Concat();
- if (args.length < 2) {
- System.err.println(tool.getUsage());
- }
- tool.setArguments(args);
- tool.execute();
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#getDestPathPDF()
- */
- protected File getDestPathPDF() throws InstantiationException {
- return (File)getValue("destfile");
- }
-
-}
diff --git a/src/main/java/com/lowagie/tools/plugins/Decrypt.java b/src/main/java/com/lowagie/tools/plugins/Decrypt.java
deleted file mode 100644
index a94b84f..0000000
--- a/src/main/java/com/lowagie/tools/plugins/Decrypt.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * $Id: Decrypt.java,v 1.4 2005/11/29 21:05:02 blowagie Exp $
- * $Name: $
- *
- * Copyright 2005 by Bruno Lowagie.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (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.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.tools.plugins;
-
-import java.io.File;
-import java.io.FileOutputStream;
-
-import javax.swing.JInternalFrame;
-import javax.swing.JOptionPane;
-
-import com.lowagie.text.pdf.PdfReader;
-import com.lowagie.text.pdf.PdfStamper;
-import com.lowagie.tools.arguments.FileArgument;
-import com.lowagie.tools.arguments.PdfFilter;
-import com.lowagie.tools.arguments.ToolArgument;
-
-/**
- * Allows you to decrypt an existing PDF file.
- */
-public class Decrypt extends AbstractTool {
-
- static {
- addVersion("$Id: Decrypt.java,v 1.4 2005/11/29 21:05:02 blowagie Exp $");
- }
-
-
- /**
- * Constructs an Decrypt object.
- */
- public Decrypt() {
- arguments.add(new FileArgument(this, "srcfile", "The file you want to decrypt", false, new PdfFilter()));
- arguments.add(new FileArgument(this, "destfile", "The file to which the decrypted PDF has to be written", true, new PdfFilter()));
- arguments.add(new ToolArgument(this, "ownerpassword", "The ownerpassword you want to add to the PDF file", String.class.getName()));
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#createFrame()
- */
- protected void createFrame() {
- internalFrame = new JInternalFrame("Decrypt", true, false, true);
- internalFrame.setSize(300, 80);
- internalFrame.setJMenuBar(getMenubar());
- System.out.println("=== Decrypt OPENED ===");
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#execute()
- */
- public void execute() {
- try {
- if (getValue("srcfile") == null) throw new InstantiationException("You need to choose a sourcefile");
- if (getValue("destfile") == null) throw new InstantiationException("You need to choose a destination file");
- byte[] ownerpassword = null;
- if (getValue("ownerpassword") != null) {
- ownerpassword = ((String)getValue("ownerpassword")).getBytes();
- }
- PdfReader reader = new PdfReader(((File)getValue("srcfile")).getAbsolutePath(), ownerpassword);
- PdfStamper stamper = new PdfStamper(reader, new FileOutputStream((File)getValue("destfile")));
- stamper.close();
- }
- catch(Exception e) {
- JOptionPane.showMessageDialog(internalFrame,
- e.getMessage(),
- e.getClass().getName(),
- JOptionPane.ERROR_MESSAGE);
- System.err.println(e.getMessage());
- }
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#valueHasChanged(com.lowagie.tools.arguments.ToolArgument)
- */
- public void valueHasChanged(ToolArgument arg) {
- if (internalFrame == null) {
- // if the internal frame is null, the tool was called from the commandline
- return;
- }
- // represent the changes of the argument in the internal frame
- }
-
- /**
- * Decrypts an existing PDF file.
- * @param args
- */
- public static void main(String[] args) {
- Decrypt tool = new Decrypt();
- if (args.length < 2) {
- System.err.println(tool.getUsage());
- }
- tool.setArguments(args);
- tool.execute();
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#getDestPathPDF()
- */
- protected File getDestPathPDF() throws InstantiationException {
- return (File)getValue("destfile");
- }
-
-}
diff --git a/src/main/java/com/lowagie/tools/plugins/DvdCover.java b/src/main/java/com/lowagie/tools/plugins/DvdCover.java
deleted file mode 100644
index 718ec6d..0000000
--- a/src/main/java/com/lowagie/tools/plugins/DvdCover.java
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- * $Id: DvdCover.java,v 1.11 2005/11/29 21:05:02 blowagie Exp $
- * $Name: $
- *
- * Copyright 2005 by Bruno Lowagie.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (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.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.tools.plugins;
-
-import java.awt.Color;
-import java.io.File;
-import java.io.FileOutputStream;
-
-import javax.swing.JInternalFrame;
-import javax.swing.JOptionPane;
-
-import com.lowagie.text.Document;
-import com.lowagie.text.DocumentException;
-import com.lowagie.text.Element;
-import com.lowagie.text.Image;
-import com.lowagie.text.Rectangle;
-import com.lowagie.text.pdf.BaseFont;
-import com.lowagie.text.pdf.PdfContentByte;
-import com.lowagie.text.pdf.PdfWriter;
-import com.lowagie.tools.arguments.FileArgument;
-import com.lowagie.tools.arguments.ImageArgument;
-import com.lowagie.tools.arguments.PdfFilter;
-import com.lowagie.tools.arguments.ToolArgument;
-
-/**
- * This is a simple tool that generates a cover for a DVD.
- */
-public class DvdCover extends AbstractTool {
-
- static {
- addVersion("$Id: DvdCover.java,v 1.11 2005/11/29 21:05:02 blowagie Exp $");
- }
-
- /**
- * Constructs a DvdCover object.
- */
- public DvdCover() {
- menuoptions = MENU_EXECUTE | MENU_EXECUTE_SHOW | MENU_EXECUTE_PRINT;
- arguments.add(new FileArgument(this, "destfile", "The file to which the PDF has to be written", true, new PdfFilter()));
- arguments.add(new ToolArgument(this, "title", "The title of the DVD", String.class.getName()));
- arguments.add(new ToolArgument(this, "backgroundcolor", "The backgroundcolor of the DVD Cover (for instance 0xFFFFFF)", Color.class.getName()));
- arguments.add(new ImageArgument(this, "front", "The front image of the DVD Cover"));
- arguments.add(new ImageArgument(this, "back", "The back image of the DVD Cover"));
- arguments.add(new ImageArgument(this, "side", "The side image of the DVD Cover"));
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#createFrame()
- */
- protected void createFrame() {
- internalFrame = new JInternalFrame("Make your own DVD Cover", true, false, true);
- internalFrame.setSize(300, 80);
- internalFrame.setJMenuBar(getMenubar());
- System.out.println("=== DvdCover OPENED ===");
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#execute()
- */
- public void execute() {
- try {
- // step 1: creation of a document-object
- Rectangle pageSize = new Rectangle(780, 525);
- if (getValue("backgroundcolor") != null) pageSize.setBackgroundColor((Color)getValue("backgroundcolor"));
- Document document = new Document(pageSize);
- // step 2:
- // we create a writer that listens to the document
- // and directs a PDF-stream to a file
- if (getValue("destfile") == null) throw new DocumentException("You must provide a destination file!");
- PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream((File)getValue("destfile")));
-
- // step 3: we open the document
- document.open();
-
- // step 4:
- PdfContentByte cb = writer.getDirectContent();
- if (getValue("title") != null) {
- cb.setFontAndSize(BaseFont.createFont(BaseFont.HELVETICA, BaseFont.WINANSI, false), 24);
- cb.beginText();
- if (getValue("front") == null) {
- cb.showTextAligned(Element.ALIGN_CENTER, (String)getValue("title"), 595f, 262f, 0f);
- }
- if (getValue("side") == null) {
- cb.showTextAligned(Element.ALIGN_CENTER, (String)getValue("title"), 385f, 262f, 270f);
- }
- cb.endText();
- }
- cb.moveTo(370, 0);
- cb.lineTo(370, 525);
- cb.moveTo(410, 525);
- cb.lineTo(410, 0);
- cb.stroke();
- if (getValue("front") != null) {
- Image front = (Image)getValue("front");
- front.scaleToFit(370, 525);
- front.setAbsolutePosition(410f + (370f - front.scaledWidth()) / 2f, (525f - front.scaledHeight()) / 2f);
- document.add(front);
- }
- if (getValue("back") != null) {
- Image back = (Image)getValue("back");
- back.scaleToFit(370, 525);
- back.setAbsolutePosition((370f - back.scaledWidth()) / 2f, (525f - back.scaledHeight()) / 2f);
- document.add(back);
- }
- if (getValue("side") != null) {
- Image side = (Image)getValue("side");
- side.scaleToFit(40, 525);
- side.setAbsolutePosition(370 + (40f - side.scaledWidth()) / 2f, (525f - side.scaledHeight()) / 2f);
- document.add(side);
- }
-
- // step 5: we close the document
- document.close();
- }
- catch(Exception e) {
- JOptionPane.showMessageDialog(internalFrame,
- e.getMessage(),
- e.getClass().getName(),
- JOptionPane.ERROR_MESSAGE);
- System.err.println(e.getMessage());
- }
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#valueHasChanged(com.lowagie.tools.arguments.ToolArgument)
- */
- public void valueHasChanged(ToolArgument arg) {
- if (internalFrame == null) {
- // if the internal frame is null, the tool was called from the commandline
- return;
- }
- // represent the changes of the argument in the internal frame
- }
-
- /**
- * Generates a DVD Cover in PDF.
- * @param args an array containing [0] a filename [1] a title [2] a backgroundcolor [3] a front image [4] a back image [5] a side image
- */
- public static void main(String[] args) {
- DvdCover tool = new DvdCover();
- if (args.length == 0) {
- System.err.println(tool.getUsage());
- }
- tool.setArguments(args);
- tool.execute();
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#getDestPathPDF()
- */
- protected File getDestPathPDF() throws InstantiationException {
- return (File)getValue("destfile");
- }
-} \ No newline at end of file
diff --git a/src/main/java/com/lowagie/tools/plugins/Encrypt.java b/src/main/java/com/lowagie/tools/plugins/Encrypt.java
deleted file mode 100644
index 7821759..0000000
--- a/src/main/java/com/lowagie/tools/plugins/Encrypt.java
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- * $Id: Encrypt.java,v 1.11 2005/11/29 21:05:02 blowagie Exp $
- * $Name: $
- *
- * Copyright 2005 by Bruno Lowagie.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (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.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.tools.plugins;
-
-import java.io.File;
-import java.io.FileOutputStream;
-
-import javax.swing.JInternalFrame;
-import javax.swing.JOptionPane;
-
-import com.lowagie.text.pdf.PdfEncryptor;
-import com.lowagie.text.pdf.PdfReader;
-import com.lowagie.text.pdf.PdfWriter;
-import com.lowagie.tools.arguments.BitsetArgument;
-import com.lowagie.tools.arguments.FileArgument;
-import com.lowagie.tools.arguments.OptionArgument;
-import com.lowagie.tools.arguments.PdfFilter;
-import com.lowagie.tools.arguments.ToolArgument;
-
-/**
- * Allows you to encrypt an existing PDF file.
- */
-public class Encrypt extends AbstractTool {
-
- static {
- addVersion("$Id: Encrypt.java,v 1.11 2005/11/29 21:05:02 blowagie Exp $");
- }
- private final static int PERMISSIONS[] = {
- PdfWriter.AllowPrinting,
- PdfWriter.AllowModifyContents,
- PdfWriter.AllowCopy,
- PdfWriter.AllowModifyAnnotations,
- PdfWriter.AllowFillIn,
- PdfWriter.AllowScreenReaders,
- PdfWriter.AllowAssembly,
- PdfWriter.AllowDegradedPrinting};
- private final static String PERMISSION_OPTIONS[] = {
- "AllowPrinting",
- "AllowModifyContents",
- "AllowCopy",
- "AllowModifyAnnotations",
- "AllowFillIn (128 bit only)",
- "AllowScreenReaders (128 bit only)",
- "AllowAssembly (128 bit only)",
- "AllowDegradedPrinting (128 bit only)"
- };
-
-
- /**
- * Constructs an Encrypt object.
- */
- public Encrypt() {
- arguments.add(new FileArgument(this, "srcfile", "The file you want to encrypt", false, new PdfFilter()));
- arguments.add(new FileArgument(this, "destfile", "The file to which the encrypted PDF has to be written", true, new PdfFilter()));
- arguments.add(new ToolArgument(this, "ownerpassword", "The ownerpassword you want to add to the PDF file", String.class.getName()));
- arguments.add(new ToolArgument(this, "userpassword", "The userpassword you want to add to the PDF file", String.class.getName()));
- arguments.add(new BitsetArgument(this, "permissions", "Permissions on the file", PERMISSION_OPTIONS));
- OptionArgument oa = new OptionArgument(this, "strength", "Strength of the encryption");
- oa.addOption("40 bit encryption", "40");
- oa.addOption("128 bit encryption", "128");
- arguments.add(oa);
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#createFrame()
- */
- protected void createFrame() {
- internalFrame = new JInternalFrame("Encrypt", true, false, true);
- internalFrame.setSize(300, 80);
- internalFrame.setJMenuBar(getMenubar());
- System.out.println("=== Encrypt OPENED ===");
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#execute()
- */
- public void execute() {
- try {
- if (getValue("srcfile") == null) throw new InstantiationException("You need to choose a sourcefile");
- if (getValue("destfile") == null) throw new InstantiationException("You need to choose a destination file");
- int permissions = 0;
- String p = (String)getValue("permissions");
- if (p != null) {
- for (int k = 0; k < p.length(); ++k) {
- permissions |= (p.charAt(k) == '0' ? 0 : PERMISSIONS[k]);
- }
- }
- byte[] userpassword = null;
- if (getValue("userpassword") != null) {
- userpassword = ((String)getValue("userpassword")).getBytes();
- }
- byte[] ownerpassword = null;
- if (getValue("ownerpassword") != null) {
- ownerpassword = ((String)getValue("ownerpassword")).getBytes();
- }
- PdfReader reader = new PdfReader(((File)getValue("srcfile")).getAbsolutePath());
- PdfEncryptor.encrypt(
- reader,
- new FileOutputStream((File)getValue("destfile")),
- userpassword,
- ownerpassword,
- permissions,
- "128".equals(getValue("strength"))
- );
- }
- catch(Exception e) {
- JOptionPane.showMessageDialog(internalFrame,
- e.getMessage(),
- e.getClass().getName(),
- JOptionPane.ERROR_MESSAGE);
- System.err.println(e.getMessage());
- }
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#valueHasChanged(com.lowagie.tools.arguments.ToolArgument)
- */
- public void valueHasChanged(ToolArgument arg) {
- if (internalFrame == null) {
- // if the internal frame is null, the tool was called from the commandline
- return;
- }
- // represent the changes of the argument in the internal frame
- }
-
- /**
- * Encrypts an existing PDF file.
- * @param args
- */
- public static void main(String[] args) {
- Encrypt tool = new Encrypt();
- if (args.length < 2) {
- System.err.println(tool.getUsage());
- }
- tool.setArguments(args);
- tool.execute();
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#getDestPathPDF()
- */
- protected File getDestPathPDF() throws InstantiationException {
- return (File)getValue("destfile");
- }
-
-}
diff --git a/src/main/java/com/lowagie/tools/plugins/ExtractAttachments.java b/src/main/java/com/lowagie/tools/plugins/ExtractAttachments.java
deleted file mode 100644
index 455f3a2..0000000
--- a/src/main/java/com/lowagie/tools/plugins/ExtractAttachments.java
+++ /dev/null
@@ -1,227 +0,0 @@
-/*
- * $Id: ExtractAttachments.java,v 1.5 2006/03/01 11:41:16 blowagie Exp $
- * $Name: $
- *
- * Copyright 2005 by Paulo Soares and Anonymous.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (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.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.tools.plugins;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Iterator;
-
-import javax.swing.JInternalFrame;
-
-import com.lowagie.text.pdf.*;
-import com.lowagie.tools.arguments.FileArgument;
-import com.lowagie.tools.arguments.LabelAccessory;
-import com.lowagie.tools.arguments.PdfFilter;
-import com.lowagie.tools.arguments.ToolArgument;
-
-/**
- * This tool lets you extract the attachements of a PDF.
- */
-public class ExtractAttachments extends AbstractTool {
-
- static {
- addVersion("$Id: ExtractAttachments.java,v 1.5 2006/03/01 11:41:16 blowagie Exp $");
- }
-
- /**
- * Constructs a ExtractAttachements object.
- */
- public ExtractAttachments() {
- FileArgument f = new FileArgument(this, "srcfile",
- "The file you want to operate on", false, new PdfFilter());
- f.setLabel(new LabelAccessory());
- arguments.add(f);
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#createFrame()
- */
- protected void createFrame() {
- internalFrame = new JInternalFrame("ExtractAttachments", true, false,
- true);
- internalFrame.setSize(300, 80);
- internalFrame.setJMenuBar(getMenubar());
- System.out.println("=== ExtractAttachments OPENED ===");
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#execute()
- */
- public void execute() {
- try {
- if (getValue("srcfile") == null)
- throw new InstantiationException(
- "You need to choose a sourcefile");
- File src = (File) getValue("srcfile");
-
- // we create a reader for a certain document
- PdfReader reader = new PdfReader(src.getAbsolutePath());
- final File parentFile = src.getParentFile();
- final String outPath;
- if (parentFile != null) {
- outPath = parentFile.getAbsolutePath();
- } else {
- outPath = "";
- }
- PdfDictionary catalog = reader.getCatalog();
- PdfDictionary names = (PdfDictionary) PdfReader
- .getPdfObject(catalog.get(PdfName.NAMES));
- if (names != null) {
- PdfDictionary embFiles = (PdfDictionary) PdfReader
- .getPdfObject(names.get(new PdfName("EmbeddedFiles")));
- if (embFiles != null) {
- HashMap embMap = PdfNameTree.readTree(embFiles);
- for (Iterator i = embMap.values().iterator(); i.hasNext();) {
- PdfDictionary filespec = (PdfDictionary) PdfReader
- .getPdfObject((PdfObject) i.next());
- unpackFile(reader, filespec, outPath);
- }
- }
- }
- for (int k = 1; k <= reader.getNumberOfPages(); ++k) {
- PdfArray annots = (PdfArray) PdfReader.getPdfObject(reader
- .getPageN(k).get(PdfName.ANNOTS));
- if (annots == null)
- continue;
- for (Iterator i = annots.listIterator(); i.hasNext();) {
- PdfDictionary annot = (PdfDictionary) PdfReader
- .getPdfObject((PdfObject) i.next());
- PdfName subType = (PdfName) PdfReader.getPdfObject(annot
- .get(PdfName.SUBTYPE));
- if (!PdfName.FILEATTACHMENT.equals(subType))
- continue;
- PdfDictionary filespec = (PdfDictionary) PdfReader
- .getPdfObject(annot.get(PdfName.FS));
- unpackFile(reader, filespec, outPath);
- }
- }
-
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#valueHasChanged(com.lowagie.tools.arguments.ToolArgument)
- */
- public void valueHasChanged(ToolArgument arg) {
- if (internalFrame == null) {
- // if the internal frame is null, the tool was called from the
- // commandline
- return;
- }
- // represent the changes of the argument in the internal frame
- }
-
- /**
- * Extract the attachements of a PDF.
- *
- * @param args
- */
- public static void main(String[] args) {
- ExtractAttachments tool = new ExtractAttachments();
- if (args.length < 1) {
- System.err.println(tool.getUsage());
- }
- tool.setArguments(args);
- tool.execute();
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#getDestPathPDF()
- */
- protected File getDestPathPDF() throws InstantiationException {
- throw new InstantiationException("There is more than one destfile.");
- }
-
- /**
- * Unpacks a file attachment.
- *
- * @param reader
- * The object that reads the PDF document
- * @param filespec
- * The dictonary containing the file specifications
- * @param outPath
- * The path where the attachment has to be written
- * @throws IOException
- */
- public static void unpackFile(PdfReader reader, PdfDictionary filespec,
- String outPath) throws IOException {
- if (filespec == null)
- return;
- PdfName type = (PdfName) PdfReader.getPdfObject(filespec
- .get(PdfName.TYPE));
- if (!PdfName.F.equals(type) && !PdfName.FILESPEC.equals(type))
- return;
- PdfDictionary ef = (PdfDictionary) PdfReader.getPdfObject(filespec
- .get(PdfName.EF));
- if (ef == null)
- return;
- PdfString fn = (PdfString) PdfReader.getPdfObject(filespec
- .get(PdfName.F));
- System.out.println("Unpacking file '" + fn + "' to " + outPath);
- if (fn == null)
- return;
- File fLast = new File(fn.toUnicodeString());
- File fullPath = new File(outPath, fLast.getName());
- if (fullPath.exists())
- return;
- PRStream prs = (PRStream) PdfReader.getPdfObject(ef.get(PdfName.F));
- if (prs == null)
- return;
- byte b[] = PdfReader.getStreamBytes(prs);
- FileOutputStream fout = new FileOutputStream(fullPath);
- fout.write(b);
- fout.close();
- }
-
-} \ No newline at end of file
diff --git a/src/main/java/com/lowagie/tools/plugins/Handouts.java b/src/main/java/com/lowagie/tools/plugins/Handouts.java
deleted file mode 100644
index fed8788..0000000
--- a/src/main/java/com/lowagie/tools/plugins/Handouts.java
+++ /dev/null
@@ -1,232 +0,0 @@
-/*
- * $Id: Handouts.java,v 1.7 2005/11/29 21:05:02 blowagie Exp $
- * $Name: $
- *
- * Copyright 2005 by Bruno Lowagie.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (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.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.tools.plugins;
-
-import java.io.File;
-import java.io.FileOutputStream;
-
-import javax.swing.JInternalFrame;
-import javax.swing.JOptionPane;
-
-import com.lowagie.text.Document;
-import com.lowagie.text.PageSize;
-import com.lowagie.text.Rectangle;
-import com.lowagie.text.pdf.PdfContentByte;
-import com.lowagie.text.pdf.PdfImportedPage;
-import com.lowagie.text.pdf.PdfReader;
-import com.lowagie.text.pdf.PdfWriter;
-import com.lowagie.tools.arguments.FileArgument;
-import com.lowagie.tools.arguments.OptionArgument;
-import com.lowagie.tools.arguments.PdfFilter;
-import com.lowagie.tools.arguments.ToolArgument;
-
-/**
- * Generates a PDF file that is useable as Handout.
- */
-public class Handouts extends AbstractTool {
-
- static {
- addVersion("$Id: Handouts.java,v 1.7 2005/11/29 21:05:02 blowagie Exp $");
- }
-
- /**
- * Constructs a Handouts object.
- */
- public Handouts() {
- arguments.add(new FileArgument(this, "srcfile", "The file you want to convert", false, new PdfFilter()));
- arguments.add(new FileArgument(this, "destfile", "The file to which the Handout has to be written", true, new PdfFilter()));
- OptionArgument oa = new OptionArgument(this, "pages", "The number of pages you want on one handout page");
- oa.addOption("2 pages on 1", "2");
- oa.addOption("3 pages on 1", "3");
- oa.addOption("4 pages on 1", "4");
- oa.addOption("5 pages on 1", "5");
- oa.addOption("6 pages on 1", "6");
- oa.addOption("7 pages on 1", "7");
- oa.addOption("8 pages on 1", "8");
- arguments.add(oa);
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#createFrame()
- */
- protected void createFrame() {
- internalFrame = new JInternalFrame("Handouts", true, false, true);
- internalFrame.setSize(300, 80);
- internalFrame.setJMenuBar(getMenubar());
- System.out.println("=== Handouts OPENED ===");
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#execute()
- */
- public void execute() {
- try {
- if (getValue("srcfile") == null) throw new InstantiationException("You need to choose a sourcefile");
- File src = (File)getValue("srcfile");
- if (getValue("destfile") == null) throw new InstantiationException("You need to choose a destination file");
- File dest = (File)getValue("destfile");
- int pages;
- try {
- pages = Integer.parseInt((String) getValue("pages"));
- }
- catch(Exception e) {
- pages = 4;
- }
-
- float x1 = 30f;
- float x2 = 280f;
- float x3 = 320f;
- float x4 = 565f;
-
- float[] y1 = new float[pages];
- float[] y2 = new float[pages];
-
- float height = (778f - (20f * (pages - 1))) / pages;
- y1[0] = 812f;
- y2[0] = 812f - height;
-
- for (int i = 1; i < pages; i++) {
- y1[i] = y2[i - 1] - 20f;
- y2[i] = y1[i] - height;
- }
-
- // we create a reader for a certain document
- PdfReader reader = new PdfReader(src.getAbsolutePath());
- // we retrieve the total number of pages
- int n = reader.getNumberOfPages();
- System.out.println("There are " + n + " pages in the original file.");
-
- // step 1: creation of a document-object
- Document document = new Document(PageSize.A4);
- // step 2: we create a writer that listens to the document
- PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(dest));
- // step 3: we open the document
- document.open();
- PdfContentByte cb = writer.getDirectContent();
- PdfImportedPage page;
- int rotation;
- int i = 0;
- int p = 0;
- // step 4: we add content
- while (i < n) {
- i++;
- Rectangle rect = reader.getPageSizeWithRotation(i);
- float factorx = (x2 - x1) / rect.width();
- float factory = (y1[p] - y2[p]) / rect.height();
- float factor = (factorx < factory ? factorx : factory);
- float dx = (factorx == factor ? 0f : ((x2 - x1) - rect.width() * factor) / 2f);
- float dy = (factory == factor ? 0f : ((y1[p] - y2[p]) - rect.height() * factor) / 2f);
- page = writer.getImportedPage(reader, i);
- rotation = reader.getPageRotation(i);
- if (rotation == 90 || rotation == 270) {
- cb.addTemplate(page, 0, -factor, factor, 0, x1 + dx, y2[p] + dy + rect.height() * factor);
- }
- else {
- cb.addTemplate(page, factor, 0, 0, factor, x1 + dx, y2[p] + dy);
- }
- cb.setRGBColorStroke(0xC0, 0xC0, 0xC0);
- cb.rectangle(x3 - 5f, y2[p] - 5f, x4 - x3 + 10f, y1[p] - y2[p] + 10f);
- for (float l = y1[p] - 19; l > y2[p]; l -= 16) {
- cb.moveTo(x3, l);
- cb.lineTo(x4, l);
- }
- cb.rectangle(x1 + dx, y2[p] + dy, rect.width() * factor, rect.height() * factor);
- cb.stroke();
- System.out.println("Processed page " + i);
- p++;
- if (p == pages) {
- p = 0;
- document.newPage();
- }
- }
- // step 5: we close the document
- document.close();
- }
- catch(Exception e) {
- JOptionPane.showMessageDialog(internalFrame,
- e.getMessage(),
- e.getClass().getName(),
- JOptionPane.ERROR_MESSAGE);
- System.err.println(e.getMessage());
- }
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#valueHasChanged(com.lowagie.tools.arguments.ToolArgument)
- */
- public void valueHasChanged(ToolArgument arg) {
- if (internalFrame == null) {
- // if the internal frame is null, the tool was called from the commandline
- return;
- }
- // represent the changes of the argument in the internal frame
- }
-
-
- /**
- * Converts a PDF file to a PDF file useable as Handout.
- * @param args
- */
- public static void main(String[] args) {
- Handouts tool = new Handouts();
- if (args.length < 2) {
- System.err.println(tool.getUsage());
- }
- tool.setArguments(args);
- tool.execute();
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#getDestPathPDF()
- */
- protected File getDestPathPDF() throws InstantiationException {
- return (File)getValue("destfile");
- }
-}
diff --git a/src/main/java/com/lowagie/tools/plugins/HtmlBookmarks.java b/src/main/java/com/lowagie/tools/plugins/HtmlBookmarks.java
deleted file mode 100644
index aa8966f..0000000
--- a/src/main/java/com/lowagie/tools/plugins/HtmlBookmarks.java
+++ /dev/null
@@ -1,288 +0,0 @@
-/*
- * $Id: HtmlBookmarks.java,v 1.12 2005/11/29 21:05:02 blowagie Exp $
- * $Name: $
- *
- * Copyright 2005 by Bruno Lowagie.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (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.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.tools.plugins;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.StringTokenizer;
-
-import javax.swing.JInternalFrame;
-import javax.swing.JOptionPane;
-
-import com.lowagie.text.Anchor;
-import com.lowagie.text.Chapter;
-import com.lowagie.text.Chunk;
-import com.lowagie.text.Document;
-import com.lowagie.text.Header;
-import com.lowagie.text.Paragraph;
-import com.lowagie.text.Section;
-import com.lowagie.text.html.HtmlTags;
-import com.lowagie.text.html.HtmlWriter;
-import com.lowagie.text.markup.MarkupTags;
-import com.lowagie.text.pdf.PdfReader;
-import com.lowagie.text.pdf.SimpleBookmark;
-import com.lowagie.tools.Executable;
-import com.lowagie.tools.arguments.FileArgument;
-import com.lowagie.tools.arguments.PdfFilter;
-import com.lowagie.tools.arguments.ToolArgument;
-
-/**
- * Allows you to generate an index file in HTML containing Bookmarks to an existing PDF file.
- */
-public class HtmlBookmarks extends AbstractTool {
-
- static {
- addVersion("$Id: HtmlBookmarks.java,v 1.12 2005/11/29 21:05:02 blowagie Exp $");
- }
-
- /**
- * Constructs an HtmlBookmarks object.
- */
- public HtmlBookmarks() {
- arguments.add(new FileArgument(this, "srcfile", "The file you want to inspect", false, new PdfFilter()));
- arguments.add(new ToolArgument(this, "ownerpassword", "The owner password if the file is encrypt", String.class.getName()));
- arguments.add(new ToolArgument(this, "css", "The path to a CSS file", String.class.getName()));
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#createFrame()
- */
- protected void createFrame() {
- internalFrame = new JInternalFrame("Html Bookmarks", true, true, true);
- internalFrame.setSize(300, 80);
- internalFrame.setJMenuBar(getMenubar());
- System.out.println("=== Html Bookmarks OPENED ===");
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#execute()
- */
- public void execute() {
- try {
- if (getValue("srcfile") == null) throw new InstantiationException("You need to choose a sourcefile");
- File src = (File)getValue("srcfile");
- PdfReader reader;
- if (getValue("ownerpassword") == null) {
- reader = new PdfReader(src.getAbsolutePath());
- }
- else {
- reader = new PdfReader(src.getAbsolutePath(), ((String)getValue("ownerpassword")).getBytes());
- }
- File directory = src.getParentFile();
- String name = src.getName();
- name = name.substring(0, name.lastIndexOf("."));
- File html = new File(directory, name + "_index.html");
- Document document = new Document();
- HtmlWriter.getInstance(document, new FileOutputStream(html));
- Object css = getValue("css");
- if (css != null) {
- document.add(new Header(HtmlTags.STYLESHEET, css.toString()));
- }
- Object title = reader.getInfo().get("Title");
- if (title == null)
- document.addTitle("Index for " + src.getName());
- else
- document.addKeywords("Index for '" + title + "'");
- Object keywords = reader.getInfo().get("Keywords");
- if (keywords != null)
- document.addKeywords((String)keywords);
- Object description = reader.getInfo().get("Subject");
- if (keywords != null)
- document.addSubject((String)description);
- document.open();
- Paragraph t;
- if (title == null)
- t = new Paragraph("Index for " + src.getName());
- else
- t = new Paragraph("Index for '" + title + "'");
- t.setMarkupAttribute(MarkupTags.HTML_ATTR_CSS_CLASS, "title");
- document.add(t);
- if (description != null) {
- Paragraph d = new Paragraph((String) description);
- d.setMarkupAttribute(MarkupTags.HTML_ATTR_CSS_CLASS, "description");
- document.add(d);
- }
- List list = SimpleBookmark.getBookmark(reader);
- if (list == null) {
- document.add(new Paragraph("This document has no bookmarks."));
- }
- else {
- HashMap c;
- for (Iterator i = list.iterator(); i.hasNext(); ) {
- c = (HashMap) i.next();
- Chapter chapter = (Chapter)createBookmark(src.getName(), null, c);
- ArrayList kids = (ArrayList) c.get("Kids");
- if (kids != null) {
- for (Iterator k = kids.iterator(); k.hasNext(); ) {
- addBookmark(src.getName(), chapter, (HashMap)k.next());
- }
- }
- document.add(chapter);
- }
- }
- document.close();
- Executable.launchBrowser(html.getAbsolutePath());
- }
- catch(Exception e) {
- e.printStackTrace();
- JOptionPane.showMessageDialog(internalFrame,
- e.getMessage(),
- e.getClass().getName(),
- JOptionPane.ERROR_MESSAGE);
- System.err.println(e.getMessage());
- }
- }
-
- /**
- * Recursive method to write Bookmark titles to the System.out.
- * @param pdf the path to the PDF file
- * @param section the section to which the bookmarks should be added
- * @param bookmark a HashMap containing a Bookmark (and possible kids)
- */
- private static void addBookmark(String pdf, Section section, HashMap bookmark) {
- Section s = createBookmark(pdf, section, bookmark);
- ArrayList kids = (ArrayList) bookmark.get("Kids");
- if (kids == null) return;
- for (Iterator i = kids.iterator(); i.hasNext(); ) {
- addBookmark(pdf, s, (HashMap)i.next());
- }
- }
-
- /**
- * Adds a line with the title and an anchor.
- * @param pdf the link to the PDF file
- * @param section the section that gets the line
- * @param bookmark the bookmark that has the data for the line
- * @return a subsection of section
- */
- private static Section createBookmark(String pdf, Section section, HashMap bookmark) {
- Section s;
- Paragraph title = new Paragraph((String)bookmark.get("Title"));
- System.out.println((String)bookmark.get("Title"));
- String action = (String)bookmark.get("Action");
- if ("GoTo".equals(action)) {
- if (bookmark.get("Page") != null) {
- String page = (String)bookmark.get("Page");
- StringTokenizer tokens = new StringTokenizer(page);
- String token = tokens.nextToken();
- Anchor anchor = new Anchor(" page" + token);
- anchor.setReference(pdf + "#page=" + token);
- title.add(anchor);
- }
- }
- else if ("URI".equals(action)) {
- String url = (String)bookmark.get("URI");
- Anchor anchor = new Anchor(" Goto URL");
- anchor.setReference(url);
- title.add(anchor);
- }
- else if ("GoToR".equals(action)) {
- String remote = (String)bookmark.get("File");
- Anchor anchor = new Anchor(" goto " + remote);
- if (bookmark.get("Named") != null) {
- String named = (String)bookmark.get("Named");
- remote = remote + "#nameddest=" + named;
- }
- else if (bookmark.get("Page") != null) {
- String page = (String)bookmark.get("Page");
- StringTokenizer tokens = new StringTokenizer(page);
- String token = tokens.nextToken();
- anchor.add(new Chunk(" page " + token));
- remote = remote + "#page=" + token;
- }
- anchor.setReference(remote);
- title.add(anchor);
- }
- if (section == null) {
- s = new Chapter(title, 0);
- }
- else {
- s = section.addSection(title);
- }
- s.setNumberDepth(0);
- return s;
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#valueHasChanged(com.lowagie.tools.arguments.ToolArgument)
- */
- public void valueHasChanged(ToolArgument arg) {
- if (internalFrame == null) {
- // if the internal frame is null, the tool was called from the commandline
- return;
- }
- // represent the changes of the argument in the internal frame
- }
-
- /**
- * Allows you to generate an index file in HTML containing Bookmarks to an existing PDF file.
- * @param args
- */
- public static void main(String[] args) {
- HtmlBookmarks tool = new HtmlBookmarks();
- if (args.length < 1) {
- System.err.println(tool.getUsage());
- }
- tool.setArguments(args);
- tool.execute();
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#getDestPathPDF()
- */
- protected File getDestPathPDF() throws InstantiationException {
- throw new InstantiationException("There is no file to show.");
- }
-
-}
diff --git a/src/main/java/com/lowagie/tools/plugins/ImageXRefViewer.java b/src/main/java/com/lowagie/tools/plugins/ImageXRefViewer.java
deleted file mode 100644
index 34bbc50..0000000
--- a/src/main/java/com/lowagie/tools/plugins/ImageXRefViewer.java
+++ /dev/null
@@ -1,256 +0,0 @@
-/*
- * $Id: ImageXRefViewer.java,v 1.3 2006/04/05 07:55:00 blowagie Exp $
- * $Name: $
- *
- * Copyright 2005 by Carsten Hammer and Bruno Lowagie.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (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.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999-2006 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000-2006 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.tools.plugins;
-
-import java.awt.BorderLayout;
-import java.awt.CardLayout;
-import java.awt.Toolkit;
-import java.io.File;
-
-import javax.swing.BorderFactory;
-import javax.swing.JInternalFrame;
-import javax.swing.JLabel;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JSpinner;
-import javax.swing.SpinnerModel;
-import javax.swing.SwingConstants;
-import javax.swing.event.ChangeEvent;
-
-import com.lowagie.text.pdf.PRStream;
-import com.lowagie.text.pdf.PdfName;
-import com.lowagie.text.pdf.PdfObject;
-import com.lowagie.text.pdf.PdfReader;
-import com.lowagie.text.pdf.PdfStream;
-import com.lowagie.tools.arguments.FileArgument;
-import com.lowagie.tools.arguments.PdfFilter;
-import com.lowagie.tools.arguments.ToolArgument;
-import javax.swing.JScrollPane;
-import com.lowagie.tools.SwingWorker;
-import java.io.*;
-import java.awt.Cursor;
-
-/**
- * Allows you to inspect the Image XObjects inside a PDF file.
- */
-public class ImageXRefViewer
- extends AbstractTool {
- static {
- addVersion("$Id: ImageXRefViewer.java,v 1.3 2006/04/05 07:55:00 blowagie Exp $");
- }
-
- class ViewXRefImages_jSpinner1_propertyChangeAdapter
- implements javax.swing.event.ChangeListener {
- private ImageXRefViewer adaptee;
- ViewXRefImages_jSpinner1_propertyChangeAdapter(ImageXRefViewer adaptee) {
- this.adaptee = adaptee;
- }
- /**
- * @see javax.swing.event.ChangeListener#stateChanged(javax.swing.event.ChangeEvent)
- */
- public void stateChanged(ChangeEvent e) {
- adaptee.jSpinner_propertyChange(e);
- }
- }
-
- JPanel jPanel1 = new JPanel();
- BorderLayout borderLayout1 = new BorderLayout();
- JLabel jLabel1 = new JLabel();
- int picturenumber = 0;
- JPanel jPanel2 = new JPanel();
- BorderLayout borderLayout2 = new BorderLayout();
- CardLayout cardLayout1 = new CardLayout();
- JPanel jPanel3 = new JPanel();
- JSpinner jSpinner1 = new JSpinner();
- BorderLayout borderLayout3 = new BorderLayout();
- SpinnerModel spinnerModel1 = jSpinner1.getModel();
- JScrollPane jScrollPane1 = new JScrollPane();
-
-
- /**
- * Creates a ViewImageXObjects object.
- */
- public ImageXRefViewer() {
- arguments.add(new FileArgument(this, "srcfile", "The file you want to inspect", false, new PdfFilter()));
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#getDestPathPDF()
- */
- protected File getDestPathPDF() throws InstantiationException {
- throw new InstantiationException("There is no file to show.");
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#createFrame()
- */
- protected void createFrame() {
- internalFrame = new JInternalFrame("View Image XObjects", true, false, true);
- internalFrame.setSize(500, 300);
- internalFrame.setJMenuBar(getMenubar());
- internalFrame.getContentPane().setLayout(borderLayout1);
- jPanel1.setLayout(borderLayout2);
- jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
- jLabel1.setText("images");
- jPanel2.setLayout(cardLayout1);
- jPanel3.setLayout(borderLayout3);
- jSpinner1.addChangeListener(new
- ViewXRefImages_jSpinner1_propertyChangeAdapter(this));
- jPanel2.setBorder(BorderFactory.createEtchedBorder());
- internalFrame.getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER);
- jPanel3.add(jSpinner1, java.awt.BorderLayout.CENTER);
- jPanel3.add(jLabel1, java.awt.BorderLayout.NORTH);
- jPanel1.add(jPanel3, java.awt.BorderLayout.NORTH);
- jPanel1.add(jScrollPane1, java.awt.BorderLayout.CENTER);
- jScrollPane1.setViewportView(jPanel2);
- System.out.println("=== Image XObject Viewer OPENED ===");
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#valueHasChanged(com.lowagie.tools.arguments.ToolArgument)
- */
- public void valueHasChanged(ToolArgument arg) {
- // do nothing
- }
-
- /**
- * Reflects the change event in the JSpinner object.
- * @param evt
- */
- public void jSpinner_propertyChange(ChangeEvent evt) {
- int blatt = Integer.parseInt(jSpinner1.getValue().toString());
- if (blatt < 0) blatt = 0;
- if (blatt >= picturenumber) blatt = picturenumber - 1;
- this.cardLayout1.show(jPanel2, String.valueOf(blatt));
- jPanel2.repaint();
- }
- /**
- * Shows the images that are added to the PDF as Image XObjects.
- * @param args
- */
- public static void main(String[] args) {
- InspectPDF tool = new InspectPDF();
- if (args.length < 1) {
- System.err.println(tool.getUsage());
- }
- tool.setArguments(args);
- tool.execute();
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#execute()
- */
- public void execute() {
- picturenumber = 0;
- try {
- if (getValue("srcfile") == null) throw new InstantiationException("You need to choose a sourcefile");
-
- SwingWorker work= new SwingWorker(){
-
- public Object construct() {
- try {
- PdfReader reader = new PdfReader( ( (File)
- getValue("srcfile")).getAbsolutePath());
- for (int i = 0; i < reader.getXrefSize(); i++) {
- PdfObject pdfobj = reader.getPdfObject(i);
- if (pdfobj != null) {
- if (pdfobj.isStream()) {
- PdfStream pdfdict = (PdfStream) pdfobj;
- PdfObject pdfsubtype = pdfdict.get(PdfName.
- SUBTYPE);
- if (pdfsubtype == null) {
- continue;
- }
- if (!pdfsubtype.toString().equals(PdfName.
- IMAGE.toString())) {
- continue;
- }
- System.out.println("picturenumber: " +
- picturenumber);
- System.out.println("height:" +
- pdfdict.get(PdfName.HEIGHT));
- System.out.println("width:" +
- pdfdict.get(PdfName.WIDTH));
- System.out.println("bitspercomponent:" +
- pdfdict.get(PdfName.BITSPERCOMPONENT));
- byte[] barr = PdfReader.getStreamBytesRaw( (
- PRStream) pdfdict);
- java.awt.Image im = Toolkit.
- getDefaultToolkit().createImage(barr);
- javax.swing.ImageIcon ii = new javax.swing.
- ImageIcon(im);
-
- JLabel jLabel1 = new JLabel();
- jLabel1.setIcon(ii);
- jPanel2.add(jLabel1, "" + picturenumber++);
- }
- }
- }
- }
- catch (InstantiationException ex) {
- }
- catch (IOException ex) {
- }
- internalFrame.setCursor(Cursor.getDefaultCursor());
- return null;
- }
- };
- internalFrame.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
- work.start();
- }
- catch(Exception e) {
- JOptionPane.showMessageDialog(internalFrame,
- e.getMessage(),
- e.getClass().getName(),
- JOptionPane.ERROR_MESSAGE);
- System.err.println(e.getMessage());
- }
- }
-}
diff --git a/src/main/java/com/lowagie/tools/plugins/InspectPDF.java b/src/main/java/com/lowagie/tools/plugins/InspectPDF.java
deleted file mode 100644
index b017221..0000000
--- a/src/main/java/com/lowagie/tools/plugins/InspectPDF.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * $Id: InspectPDF.java,v 1.6 2005/11/29 21:05:02 blowagie Exp $
- * $Name: $
- *
- * Copyright 2005 by Bruno Lowagie.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (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.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.tools.plugins;
-
-import java.io.File;
-import java.util.HashMap;
-import java.util.Iterator;
-
-import javax.swing.JInternalFrame;
-import javax.swing.JOptionPane;
-
-import com.lowagie.text.pdf.PdfEncryptor;
-import com.lowagie.text.pdf.PdfReader;
-import com.lowagie.tools.arguments.FileArgument;
-import com.lowagie.tools.arguments.PdfFilter;
-import com.lowagie.tools.arguments.ToolArgument;
-
-/**
- * Allows you to inspect an existing PDF file.
- */
-public class InspectPDF extends AbstractTool {
- static {
- addVersion("$Id: InspectPDF.java,v 1.6 2005/11/29 21:05:02 blowagie Exp $");
- }
-
- /**
- * Constructs an InpectPDF object.
- */
- public InspectPDF() {
- arguments.add(new FileArgument(this, "srcfile", "The file you want to inspect", false, new PdfFilter()));
- arguments.add(new ToolArgument(this, "ownerpassword", "The owner password if the file is encrypt", String.class.getName()));
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#createFrame()
- */
- protected void createFrame() {
- internalFrame = new JInternalFrame("Pdf Information", true, false, true);
- internalFrame.setSize(300, 80);
- internalFrame.setJMenuBar(getMenubar());
- System.out.println("=== Pdf Information OPENED ===");
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#execute()
- */
- public void execute() {
- try {
- if (getValue("srcfile") == null) throw new InstantiationException("You need to choose a sourcefile");
- PdfReader reader;
- if (getValue("ownerpassword") == null) {
- reader = new PdfReader(((File)getValue("srcfile")).getAbsolutePath());
- }
- else {
- reader = new PdfReader(((File)getValue("srcfile")).getAbsolutePath(), ((String)getValue("ownerpassword")).getBytes());
- }
- // Some general document information and page size
- System.out.println("=== Document Information ===");
- System.out.println("PDF Version: " + reader.getPdfVersion());
- System.out.println("Number of pages: " + reader.getNumberOfPages());
- System.out.println("Number of PDF objects: " + reader.getXrefSize());
- System.out.println("File length: " + reader.getFileLength());
- System.out.println("Encrypted? " + reader.isEncrypted());
- if (reader.isEncrypted()) {
- System.out.println("Permissions: " + PdfEncryptor.getPermissionsVerbose(reader.getPermissions()));
- System.out.println("128 bit? " + reader.is128Key());
- }
- System.out.println("Rebuilt? " + (!reader.isRebuilt()));
- // Some metadata
- System.out.println("=== Metadata ===");
- HashMap info = reader.getInfo();
- String key;
- String value;
- for (Iterator i = info.keySet().iterator(); i.hasNext(); ) {
- key = (String) i.next();
- value = (String) info.get(key);
- System.out.println(key + ": " + value);
- }
- if (reader.getMetadata() == null) {
- System.out.println("There is no XML Metadata in the file");
- }
- else {
- System.out.println("XML Metadata: " + new String(reader.getMetadata()));
- }
- }
- catch(Exception e) {
- JOptionPane.showMessageDialog(internalFrame,
- e.getMessage(),
- e.getClass().getName(),
- JOptionPane.ERROR_MESSAGE);
- System.err.println(e.getMessage());
- }
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#valueHasChanged(com.lowagie.tools.arguments.ToolArgument)
- */
- public void valueHasChanged(ToolArgument arg) {
- if (internalFrame == null) {
- // if the internal frame is null, the tool was called from the commandline
- return;
- }
- // represent the changes of the argument in the internal frame
- }
-
- /**
- * Inspects an existing PDF file.
- * @param args
- */
- public static void main(String[] args) {
- InspectPDF tool = new InspectPDF();
- if (args.length < 1) {
- System.err.println(tool.getUsage());
- }
- tool.setArguments(args);
- tool.execute();
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#getDestPathPDF()
- */
- protected File getDestPathPDF() throws InstantiationException {
- throw new InstantiationException("There is no file to show.");
- }
-
-}
diff --git a/src/main/java/com/lowagie/tools/plugins/KnitTiff.java b/src/main/java/com/lowagie/tools/plugins/KnitTiff.java
deleted file mode 100644
index 428bbb7..0000000
--- a/src/main/java/com/lowagie/tools/plugins/KnitTiff.java
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- * $Id: KnitTiff.java,v 1.7 2005/11/29 21:05:02 blowagie Exp $
- * $Name: $
- *
- * Copyright 2005 by Bruno Lowagie.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (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.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.tools.plugins;
-
-import java.io.File;
-import java.io.FileOutputStream;
-
-import javax.swing.JInternalFrame;
-
-import com.lowagie.text.Document;
-import com.lowagie.text.Image;
-import com.lowagie.text.Rectangle;
-import com.lowagie.text.pdf.PdfContentByte;
-import com.lowagie.text.pdf.PdfWriter;
-import com.lowagie.text.pdf.RandomAccessFileOrArray;
-import com.lowagie.text.pdf.codec.TiffImage;
-import com.lowagie.tools.arguments.FileArgument;
-import com.lowagie.tools.arguments.ImageFilter;
-import com.lowagie.tools.arguments.PdfFilter;
-import com.lowagie.tools.arguments.ToolArgument;
-
-/**
- * Knits two TIFF files, one with the even pages and another with the odd pages, together.
- */
-public class KnitTiff extends AbstractTool {
-
- static {
- addVersion("$Id: KnitTiff.java,v 1.7 2005/11/29 21:05:02 blowagie Exp $");
- }
- /**
- * Constructs a KnitTiff object.
- */
- public KnitTiff() {
- menuoptions = MENU_EXECUTE | MENU_EXECUTE_SHOW;
- arguments.add(new FileArgument(this, "odd", "The tiff file with the odd pages", false, new ImageFilter(false, false, false, false, false, true)));
- arguments.add(new FileArgument(this, "even", "The tiff file with the even pages", false, new ImageFilter(false, false, false, false, false, true)));
- arguments.add(new FileArgument(this, "destfile", "The file to which the converted TIFF has to be written", true, new PdfFilter()));
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#createFrame()
- */
- protected void createFrame() {
- internalFrame = new JInternalFrame("KnitTiff", true, false, true);
- internalFrame.setSize(300, 80);
- internalFrame.setJMenuBar(getMenubar());
- System.out.println("=== KnitTiff OPENED ===");
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#execute()
- */
- public void execute() {
- try {
- if (getValue("odd") == null) throw new InstantiationException("You need to choose a sourcefile for the odd pages");
- File odd_file = (File)getValue("odd");
- if (getValue("even") == null) throw new InstantiationException("You need to choose a sourcefile for the even pages");
- File even_file = (File)getValue("even");
- if (getValue("destfile") == null) throw new InstantiationException("You need to choose a destination file");
- File pdf_file = (File)getValue("destfile");
- RandomAccessFileOrArray odd = new RandomAccessFileOrArray(odd_file.getAbsolutePath());
- RandomAccessFileOrArray even = new RandomAccessFileOrArray(even_file.getAbsolutePath());
- Image img = TiffImage.getTiffImage(odd, 1);
- Document document = new Document(new Rectangle(img.scaledWidth(),
- img.scaledHeight()));
- PdfWriter writer = PdfWriter.getInstance(document,
- new FileOutputStream(pdf_file));
- document.open();
- PdfContentByte cb = writer.getDirectContent();
- int count = Math.max(TiffImage.getNumberOfPages(odd), TiffImage
- .getNumberOfPages(even));
- for (int c = 0; c < count; ++c) {
- try {
- Image imgOdd = TiffImage.getTiffImage(odd, c + 1);
- Image imgEven = TiffImage.getTiffImage(even, count - c);
- document.setPageSize(new Rectangle(imgOdd.scaledWidth(),
- imgOdd.scaledHeight()));
- document.newPage();
- imgOdd.setAbsolutePosition(0, 0);
- cb.addImage(imgOdd);
- document.setPageSize(new Rectangle(imgEven.scaledWidth(),
- imgEven.scaledHeight()));
- document.newPage();
- imgEven.setAbsolutePosition(0, 0);
- cb.addImage(imgEven);
-
- } catch (Exception e) {
- System.out.println("Exception page " + (c + 1) + " "
- + e.getMessage());
- }
- }
- odd.close();
- even.close();
- document.close();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#valueHasChanged(com.lowagie.tools.arguments.ToolArgument)
- */
- public void valueHasChanged(ToolArgument arg) {
- if (internalFrame == null) {
- // if the internal frame is null, the tool was called from the commandline
- return;
- }
- // represent the changes of the argument in the internal frame
- }
-
-
- /**
- * Converts a tiff file to PDF.
- * @param args
- */
- public static void main(String[] args) {
- KnitTiff tool = new KnitTiff();
- if (args.length < 3) {
- System.err.println(tool.getUsage());
- }
- tool.setArguments(args);
- tool.execute();
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#getDestPathPDF()
- */
- protected File getDestPathPDF() throws InstantiationException {
- return (File)getValue("destfile");
- }
-}
diff --git a/src/main/java/com/lowagie/tools/plugins/LPRClient.java b/src/main/java/com/lowagie/tools/plugins/LPRClient.java
deleted file mode 100644
index 3214013..0000000
--- a/src/main/java/com/lowagie/tools/plugins/LPRClient.java
+++ /dev/null
@@ -1,245 +0,0 @@
-/*
- * $Id: LPRClient.java,v 1.4 2005/11/29 21:05:02 blowagie Exp $
- * $Name: $
- *
- * Copyright 2005 by Anonymous.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (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.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.tools.plugins;
-
-import java.io.File;
-
-import javax.swing.JInternalFrame;
-import javax.swing.JOptionPane;
-
-import com.lowagie.tools.arguments.FileArgument;
-import com.lowagie.tools.arguments.PdfFilter;
-import com.lowagie.tools.arguments.ToolArgument;
-import com.lowagie.tools.LPR;
-
-/**
- * Allows you to print an existing PDF file via lpr.
- */
-public class LPRClient extends AbstractTool {
- static {
- addVersion("$Id: LPRClient.java,v 1.4 2005/11/29 21:05:02 blowagie Exp $");
- }
-
-String fallback="%!PS\n"+
- "/vpos 720 def\n"+
- "/newline\n"+
- " {\n"+
- "/vpos vpos 15 sub def\n"+
- "72 vpos moveto\n"+
- "} def \n"+
- "/printword\n"+
- "{\n"+
- "show\n"+
- "newline\n"+
- "vpos 100 le { \n"+
- "showpage\n"+
- "100 100 moveto\n"+
- "/vpos 720 def\n"+
- "/Helvetica findfont 15 scalefont setfont\n"+
- "} if\n"+
- "} def \n"+
- "/nstr 9 string def\n"+
- "/prt-n\n"+
- "{\n"+
- "nstr cvs printword\n"+
- "} def\n"+
- "100 100 moveto\n"+
- "/Helvetica findfont 15 scalefont setfont\n"+
- "(---) printword \n"+
- "(Postscript Engine Testpage) printword\n"+
- "() printword\n"+
- "() printword\n"+
- "(Defaultpagesize) printword\n"+
- "currentpagedevice /PageSize get\n"+
- "(Width: ) show \n"+
- "0 get prt-n\n"+
- "currentpagedevice /PageSize get\n"+
- "(Height: ) show \n"+
- "1 get prt-n\n"+
- "() printword\n"+
- "(Printerresolution) printword\n"+
- "currentpagedevice /HWResolution get\n"+
- "(X: ) show \n"+
- "0 get prt-n\n"+
- "currentpagedevice /HWResolution get\n"+
- "(Y: ) show \n"+
- "1 get prt-n\n"+
- "() printword\n"+
- "(Information about Postscriptengine) printword\n"+
- "(Postscriptengine Type: ) show\n"+
- "product printword\n"+
- "(Version: ) show\n"+
- "version printword\n"+
- "() printword \n"+
- "mark\n"+
- "(\n) \n"+
- "revision 10 mod \n"+
- "revision 100 mod 10 idiv (.)\n"+
- "revision 100 idiv \n"+
- "(Revision: )\n"+
- "(\n) \n"+
- "counttomark\n"+
- "{ 17 string cvs show\n"+
- "} repeat pop \n"+
- "() printword \n"+
- "(Postscript Languagelevel: ) show\n"+
- "/languagelevel where\n"+
- "{pop languagelevel}\n"+
- "{1}\n"+
- "ifelse\n"+
- "3 string cvs printword \n"+
- "usertime \n"+
- "prt-n \n"+
- "vmstatus\n"+
- "(Printerram Max.: ) show\n"+
- "prt-n\n"+
- "(Printerram Cur.: ) show\n"+
- "prt-n\n"+
- "() printword\n"+
- "showpage";
- /**
- * Constructs an LPRClient object.
- */
- public LPRClient() {
- arguments.add(new FileArgument(this, "srcfile",
- "The file you want to print", false, new PdfFilter()));
- arguments.add(new ToolArgument(this, "hostname",
- "The hostname of the lpr server", String.class.getName()));
- arguments.add(new ToolArgument(this, "queuename",
- "The queuename of the lpr server", String.class.getName()));
- arguments.add(new ToolArgument(this, "copies",
- "The number of copies to print", String.class.getName()));
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#createFrame()
- */
- protected void createFrame() {
- internalFrame = new JInternalFrame("LPR", true, false, true);
- internalFrame.setSize(500, 300);
- internalFrame.setJMenuBar(getMenubar());
- System.out.println("=== LPR OPENED ===");
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#execute()
- */
- public void execute() {
- try {
- String filename=null;
- File pdffile=null;
- if (getValue("srcfile") == null){
- filename=null;
- }else{
- filename = getValue("srcfile").toString();
- pdffile = new File(filename);
- }
-// throw new InstantiationException(
-// "You need to choose a sourcefile");
- if (getValue("hostname") == null)
- throw new InstantiationException(
- "You need to choose a hostname");
- if (getValue("queuename") == null)
- throw new InstantiationException(
- "You need to choose a queuename");
- if (getValue("copies") == null)
- throw new InstantiationException(
- "You need to choose the number of copies");
- LPR lpr = new LPR(getValue("hostname").toString(), System
- .getProperty("user.name"));
- lpr.setCopies(Integer.parseInt(getValue("copies").toString()));
- if(filename==null){
- lpr.print(getValue("queuename").toString(), fallback, "Version");
- }else{
- lpr.print(getValue("queuename").toString(), pdffile, pdffile
- .getName());
- }
-
- } catch (Exception e) {
- JOptionPane.showMessageDialog(internalFrame, e.getMessage(), e
- .getClass().getName(), JOptionPane.ERROR_MESSAGE);
- System.err.println(e.getMessage());
- }
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#valueHasChanged(com.lowagie.tools.arguments.ToolArgument)
- */
- public void valueHasChanged(ToolArgument arg) {
- if (internalFrame == null) {
- // if the internal frame is null, the tool was called from the
- // commandline
- return;
- }
- // represent the changes of the argument in the internal frame
- }
-
- /**
- * Prints a PDF file via lpr.
- *
- * @param args
- */
- public static void main(String[] args) {
- LPRClient tool = new LPRClient();
- if (args.length < tool.getArguments().size()) {
- System.err.println(tool.getUsage());
- }
- tool.setArguments(args);
- tool.execute();
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#getDestPathPDF()
- */
- protected File getDestPathPDF() throws InstantiationException {
- throw new InstantiationException("There is no file to show.");
- }
-
-}
diff --git a/src/main/java/com/lowagie/tools/plugins/NUp.java b/src/main/java/com/lowagie/tools/plugins/NUp.java
deleted file mode 100644
index 7376213..0000000
--- a/src/main/java/com/lowagie/tools/plugins/NUp.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * $Id: NUp.java,v 1.6 2005/11/29 21:05:02 blowagie Exp $
- * $Name: $
- *
- * This code is free software. It may only be copied or modified
- * if you include the following copyright notice:
- *
- * This class by Mark Thompson. Copyright (c) 2002 Mark Thompson.
- *
- * This code is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * itext-questions@list.sourceforge.net
- */
-package com.lowagie.tools.plugins;
-
-import java.io.File;
-import java.io.FileOutputStream;
-
-import javax.swing.JInternalFrame;
-
-import com.lowagie.text.Document;
-import com.lowagie.text.Rectangle;
-import com.lowagie.text.pdf.PdfContentByte;
-import com.lowagie.text.pdf.PdfImportedPage;
-import com.lowagie.text.pdf.PdfReader;
-import com.lowagie.text.pdf.PdfWriter;
-import com.lowagie.tools.arguments.FileArgument;
-import com.lowagie.tools.arguments.OptionArgument;
-import com.lowagie.tools.arguments.PdfFilter;
-import com.lowagie.tools.arguments.ToolArgument;
-
-/**
- * This tool lets you generate a PDF that shows N pages on 1.
- */
-public class NUp extends AbstractTool {
-
- static {
- addVersion("$Id: NUp.java,v 1.6 2005/11/29 21:05:02 blowagie Exp $");
- }
-
- /**
- * Constructs an NUp object.
- */
- public NUp() {
- menuoptions = MENU_EXECUTE | MENU_EXECUTE_SHOW;
- arguments.add(new FileArgument(this, "srcfile", "The file you want to N-up", false, new PdfFilter()));
- arguments.add(new FileArgument(this, "destfile", "The resulting PDF", true, new PdfFilter()));
- OptionArgument oa = new OptionArgument(this, "pow2", "The number of pages you want to copy to 1 page");
- oa.addOption("2", "1");
- oa.addOption("4", "2");
- oa.addOption("8", "3");
- oa.addOption("16", "4");
- oa.addOption("32", "5");
- oa.addOption("64", "6");
- arguments.add(oa);
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#createFrame()
- */
- protected void createFrame() {
- internalFrame = new JInternalFrame("N-up", true, false, true);
- internalFrame.setSize(300, 80);
- internalFrame.setJMenuBar(getMenubar());
- System.out.println("=== N-up OPENED ===");
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#execute()
- */
- public void execute() {
- try {
- if (getValue("srcfile") == null) throw new InstantiationException("You need to choose a sourcefile");
- File src = (File)getValue("srcfile");
- if (getValue("destfile") == null) throw new InstantiationException("You need to choose a destination file");
- File dest = (File)getValue("destfile");
- int pow2;
- try {
- pow2 = Integer.parseInt((String) getValue("pow2"));
- }
- catch(Exception e) {
- pow2 = 1;
- }
- // we create a reader for a certain document
- PdfReader reader = new PdfReader(src.getAbsolutePath());
- // we retrieve the total number of pages and the page size
- int total = reader.getNumberOfPages();
- System.out.println("There are " + total + " pages in the original file.");
- Rectangle pageSize = reader.getPageSize(1);
- Rectangle newSize = (pow2 % 2) == 0 ? new Rectangle(pageSize.width(), pageSize.height()) : new Rectangle(pageSize.height(), pageSize.width());
- Rectangle unitSize = new Rectangle(pageSize.width(), pageSize.height());
- Rectangle currentSize;
- for (int i = 0; i < pow2; i++) {
- unitSize = new Rectangle(unitSize.height() / 2, unitSize.width());
- }
- int n = (int)Math.pow(2, pow2);
- int r = (int)Math.pow(2, (int)pow2 / 2);
- int c = n / r;
- // step 1: creation of a document-object
- Document document = new Document(newSize, 0, 0, 0, 0);
- // step 2: we create a writer that listens to the document
- PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(dest));
- // step 3: we open the document
- document.open();
- // step 4: adding the content
- PdfContentByte cb = writer.getDirectContent();
- PdfImportedPage page;
- float offsetX, offsetY, factor;
- int p;
- for (int i = 0; i < total; i++) {
- if (i % n == 0) {
- document.newPage();
- }
- p = i + 1;
- offsetX = unitSize.width() * ((i % n) % c);
- offsetY = newSize.height() - (unitSize.height() * (((i % n) / c) + 1));
- currentSize = reader.getPageSize(p);
- factor = Math.min(unitSize.width() / currentSize.width(), unitSize.height() / currentSize.height());
- offsetX += (unitSize.width() - (currentSize.width() * factor)) / 2f;
- offsetY += (unitSize.height() - (currentSize.height() * factor)) / 2f;
- page = writer.getImportedPage(reader, p);
- cb.addTemplate(page, factor, 0, 0, factor, offsetX, offsetY);
- }
- // step 5: we close the document
- document.close();
- }
- catch(Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#valueHasChanged(com.lowagie.tools.arguments.ToolArgument)
- */
- public void valueHasChanged(ToolArgument arg) {
- if (internalFrame == null) {
- // if the internal frame is null, the tool was called from the commandline
- return;
- }
- // represent the changes of the argument in the internal frame
- }
-
-
- /**
- * Generates an NUp version of an existing PDF file.
- * @param args
- */
- public static void main(String[] args) {
- NUp tool = new NUp();
- if (args.length < 2) {
- System.err.println(tool.getUsage());
- }
- tool.setArguments(args);
- tool.execute();
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#getDestPathPDF()
- */
- protected File getDestPathPDF() throws InstantiationException {
- return (File)getValue("destfile");
- }
-}
diff --git a/src/main/java/com/lowagie/tools/plugins/PhotoAlbum.java b/src/main/java/com/lowagie/tools/plugins/PhotoAlbum.java
deleted file mode 100644
index 26a95f3..0000000
--- a/src/main/java/com/lowagie/tools/plugins/PhotoAlbum.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * $Id: PhotoAlbum.java,v 1.8 2006/03/21 08:49:35 blowagie Exp $
- * $Name: $
- *
- * Copyright 2005 by Bruno Lowagie.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (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.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.tools.plugins;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.util.Iterator;
-import java.util.TreeSet;
-
-import javax.swing.JInternalFrame;
-import javax.swing.JOptionPane;
-
-import com.lowagie.text.Document;
-import com.lowagie.text.Image;
-import com.lowagie.text.Rectangle;
-import com.lowagie.text.pdf.PdfPageLabels;
-import com.lowagie.text.pdf.PdfWriter;
-import com.lowagie.tools.arguments.DirFilter;
-import com.lowagie.tools.arguments.FileArgument;
-import com.lowagie.tools.arguments.PdfFilter;
-import com.lowagie.tools.arguments.ToolArgument;
-
-/**
- * Converts a Tiff file to a PDF file.
- * Inspired by a comp.text.pdf question by Sebastian Schubert
- * and an answer by Hans-Werner Hilse.
- */
-public class PhotoAlbum extends AbstractTool {
-
- static {
- addVersion("$Id: PhotoAlbum.java,v 1.8 2006/03/21 08:49:35 blowagie Exp $");
- }
- /**
- * Constructs a PhotoAlbum object.
- */
- public PhotoAlbum() {
- menuoptions = MENU_EXECUTE | MENU_EXECUTE_SHOW;
- arguments.add(new FileArgument(this, "srcdir", "The directory containing the image files", false, new DirFilter()));
- arguments.add(new FileArgument(this, "destfile", "The file to which the converted TIFF has to be written", true, new PdfFilter()));
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#createFrame()
- */
- protected void createFrame() {
- internalFrame = new JInternalFrame("PhotoAlbum", true, false, true);
- internalFrame.setSize(300, 80);
- internalFrame.setJMenuBar(getMenubar());
- System.out.println("=== PhotoAlbum OPENED ===");
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#execute()
- */
- public void execute() {
- try {
- if (getValue("srcdir") == null) throw new InstantiationException("You need to choose a source directory");
- File directory = (File)getValue("srcdir");
- if (directory.isFile()) directory = directory.getParentFile();
- if (getValue("destfile") == null) throw new InstantiationException("You need to choose a destination file");
- File pdf_file = (File)getValue("destfile");
- Document document = new Document();
- PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(pdf_file));
- writer.setViewerPreferences(PdfWriter.PageModeUseThumbs);
- PdfPageLabels pageLabels = new PdfPageLabels();
- int dpiX, dpiY;
- float imgWidthPica, imgHeightPica;
- TreeSet images = new TreeSet();
- File[] files = directory.listFiles();
- for (int i = 0; i < files.length; i++) {
- if (files[i].isFile()) images.add(files[i]);
- }
- File image;
- String label;
- for (Iterator i = images.iterator(); i.hasNext(); ) {
- image = (File) i.next();
- System.out.println("Testing image: " + image.getName());
- try {
- Image img = Image.getInstance(image.getAbsolutePath());
- dpiX=img.getDpiX();
- if (dpiX == 0) dpiX=72;
- dpiY=img.getDpiY();
- if (dpiY == 0) dpiY=72;
- imgWidthPica=(72*img.plainWidth()) / dpiX;
- imgHeightPica=(72*img.plainHeight()) / dpiY;
- img.scaleAbsolute(imgWidthPica,imgHeightPica);
- document.setPageSize(new Rectangle(imgWidthPica, imgHeightPica));
- if (document.isOpen()) {
- document.newPage();
- }
- else {
- document.open();
- }
- img.setAbsolutePosition(0, 0);
- document.add(img);
- label = image.getName();
- if (label.lastIndexOf(".") > 0);
- label = label.substring(0, label.lastIndexOf("."));
- pageLabels.addPageLabel(writer.getPageNumber(), PdfPageLabels.EMPTY, label);
- System.out.println("Added image: " + image.getName());
- }
- catch(Exception e) {
- System.err.println(e.getMessage());
- }
- }
- if (document.isOpen()) {
- writer.setPageLabels(pageLabels);
- document.close();
- }
- else {
- System.err.println("No images were found in directory " + directory.getAbsolutePath());
- }
- } catch (Exception e) {
- JOptionPane.showMessageDialog(internalFrame,
- e.getMessage(),
- e.getClass().getName(),
- JOptionPane.ERROR_MESSAGE);
- System.err.println(e.getMessage());
- }
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#valueHasChanged(com.lowagie.tools.arguments.ToolArgument)
- */
- public void valueHasChanged(ToolArgument arg) {
- if (internalFrame == null) {
- // if the internal frame is null, the tool was called from the commandline
- return;
- }
- // represent the changes of the argument in the internal frame
- }
-
-
- /**
- * Converts a tiff file to PDF.
- * @param args
- */
- public static void main(String[] args) {
- PhotoAlbum tool = new PhotoAlbum();
- if (args.length < 2) {
- System.err.println(tool.getUsage());
- }
- tool.setArguments(args);
- tool.execute();
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#getDestPathPDF()
- */
- protected File getDestPathPDF() throws InstantiationException {
- return (File)getValue("destfile");
- }
-}
diff --git a/src/main/java/com/lowagie/tools/plugins/RemoveLaunchApplication.java b/src/main/java/com/lowagie/tools/plugins/RemoveLaunchApplication.java
deleted file mode 100644
index fc082e7..0000000
--- a/src/main/java/com/lowagie/tools/plugins/RemoveLaunchApplication.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * $Id: RemoveLaunchApplication.java,v 1.4 2005/11/29 21:05:02 blowagie Exp $
- * $Name: $
- *
- * Copyright 2005 by Bruno Lowagie
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (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.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.tools.plugins;
-
-import java.io.File;
-import java.io.FileOutputStream;
-
-import javax.swing.JInternalFrame;
-
-import com.lowagie.text.pdf.PRIndirectReference;
-import com.lowagie.text.pdf.PdfDictionary;
-import com.lowagie.text.pdf.PdfName;
-import com.lowagie.text.pdf.PdfObject;
-import com.lowagie.text.pdf.PdfReader;
-import com.lowagie.text.pdf.PdfStamper;
-import com.lowagie.text.pdf.PdfString;
-import com.lowagie.tools.arguments.FileArgument;
-import com.lowagie.tools.arguments.PdfFilter;
-import com.lowagie.tools.arguments.ToolArgument;
-
-/**
- * This tool copies an existing PDF and removes potentially dangerous code that launches an application.
- */
-public class RemoveLaunchApplication
- extends AbstractTool {
-
- static {
- addVersion(
- "$Id: RemoveLaunchApplication.java,v 1.4 2005/11/29 21:05:02 blowagie Exp $");
- }
-
- /**
- * Constructs a ReversePages object.
- */
- public RemoveLaunchApplication() {
- menuoptions = MENU_EXECUTE | MENU_EXECUTE_SHOW;
- arguments.add(new FileArgument(this, "srcfile",
- "The file from which you want to remove Launch Application actions", false,
- new PdfFilter()));
- arguments.add(new FileArgument(this, "destfile",
- "The file to which the cleaned up version of the original PDF has to be written", true,
- new PdfFilter()));
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#createFrame()
- */
- protected void createFrame() {
- internalFrame = new JInternalFrame("Remove Launch Applications", true, false, true);
- internalFrame.setSize(300, 80);
- internalFrame.setJMenuBar(getMenubar());
- System.out.println("=== Remove Launch Applications OPENED ===");
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#execute()
- */
- public void execute() {
- try {
- if (getValue("srcfile") == null) {
- throw new InstantiationException("You need to choose a sourcefile");
- }
- File src = (File) getValue("srcfile");
- if (getValue("destfile") == null) {
- throw new InstantiationException(
- "You need to choose a destination file");
- }
- File dest = (File) getValue("destfile");
-
- // we create a reader for a certain document
- PdfReader reader = new PdfReader(src.getAbsolutePath());
- PdfObject o;
- PdfDictionary d;
- PdfDictionary l;
- PdfName n;
- for (int i = 1; i < reader.getXrefSize(); i++) {
- o = reader.getPdfObject(i);
- if (o instanceof PdfDictionary) {
- d = (PdfDictionary)o;
- o = d.get(PdfName.A);
- if (o == null) continue;
- if (o instanceof PdfDictionary) {
- l = (PdfDictionary)o;
- }
- else {
- PRIndirectReference r =(PRIndirectReference)o;
- l = (PdfDictionary)reader.getPdfObject(r.getNumber());
- }
- n = (PdfName)l.get(PdfName.S);
- if (PdfName.LAUNCH.equals(n)) {
- if (l.get(PdfName.F) != null) {
- System.out.println("Removed: " + l.get(PdfName.F));
- l.remove(PdfName.F);
- }
- if (l.get(PdfName.WIN) != null) {
- System.out.println("Removed: " + l.get(PdfName.WIN));
- l.remove(PdfName.WIN);
- }
- l.put(PdfName.S, PdfName.JAVASCRIPT);
- l.put(PdfName.JS, new PdfString("app.alert('Launch Application Action removed by iText');\r"));
- }
- }
- }
- PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(dest));
- stamper.close();
- }
- catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#valueHasChanged(com.lowagie.tools.arguments.ToolArgument)
- */
- public void valueHasChanged(ToolArgument arg) {
- if (internalFrame == null) {
- // if the internal frame is null, the tool was called from the commandline
- return;
- }
- // represent the changes of the argument in the internal frame
- }
-
- /**
- * Copy an existing PDF and replace the Launch Application Action with JavaScript alerts.
- * @param args
- */
- public static void main(String[] args) {
- RemoveLaunchApplication tool = new RemoveLaunchApplication();
- if (args.length < 2) {
- System.err.println(tool.getUsage());
- }
- tool.setArguments(args);
- tool.execute();
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#getDestPathPDF()
- */
- protected File getDestPathPDF() throws InstantiationException {
- return (File) getValue("destfile");
- }
-} \ No newline at end of file
diff --git a/src/main/java/com/lowagie/tools/plugins/ReversePages.java b/src/main/java/com/lowagie/tools/plugins/ReversePages.java
deleted file mode 100644
index 52b3053..0000000
--- a/src/main/java/com/lowagie/tools/plugins/ReversePages.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * $Id: ReversePages.java,v 1.3 2005/11/29 21:05:02 blowagie Exp $
- * $Name: $
- *
- * Copyright 2005 by Bruno Lowagie and anonymous.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (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.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.tools.plugins;
-
-import java.io.File;
-import java.io.FileOutputStream;
-
-import javax.swing.JInternalFrame;
-
-import com.lowagie.text.Document;
-import com.lowagie.text.pdf.PRAcroForm;
-import com.lowagie.text.pdf.PdfCopy;
-import com.lowagie.text.pdf.PdfImportedPage;
-import com.lowagie.text.pdf.PdfReader;
-import com.lowagie.tools.arguments.FileArgument;
-import com.lowagie.tools.arguments.PdfFilter;
-import com.lowagie.tools.arguments.ToolArgument;
-
-/**
- * This tool lets you take pages from an existing PDF and copy them in reverse order into a new PDF.
- */
-public class ReversePages
- extends AbstractTool {
-
- static {
- addVersion(
- "$Id: ReversePages.java,v 1.3 2005/11/29 21:05:02 blowagie Exp $");
- }
-
- /**
- * Constructs a ReversePages object.
- */
- public ReversePages() {
- menuoptions = MENU_EXECUTE | MENU_EXECUTE_SHOW;
- arguments.add(new FileArgument(this, "srcfile",
- "The file you want to reorder", false,
- new PdfFilter()));
- arguments.add(new FileArgument(this, "destfile",
- "The file to which the reordered version of the original PDF has to be written", true,
- new PdfFilter()));
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#createFrame()
- */
- protected void createFrame() {
- internalFrame = new JInternalFrame("ReversePages", true, false, true);
- internalFrame.setSize(300, 80);
- internalFrame.setJMenuBar(getMenubar());
- System.out.println("=== ReversePages OPENED ===");
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#execute()
- */
- public void execute() {
- try {
- if (getValue("srcfile") == null) {
- throw new InstantiationException("You need to choose a sourcefile");
- }
- File src = (File) getValue("srcfile");
- if (getValue("destfile") == null) {
- throw new InstantiationException(
- "You need to choose a destination file");
- }
- File dest = (File) getValue("destfile");
-
- // we create a reader for a certain document
- PdfReader reader = new PdfReader(src.getAbsolutePath());
- System.out.println("The original file had " + reader.getNumberOfPages() +
- " pages.");
- int pages = reader.getNumberOfPages();
- java.util.ArrayList li=new java.util.ArrayList();
- for(int i=pages;i>0;i--){
- li.add(new Integer(i));
- }
- reader.selectPages(li);
-
- System.err.println("The new file has " + pages + " pages.");
- Document document = new Document(reader.getPageSizeWithRotation(1));
- PdfCopy copy = new PdfCopy(document,
- new FileOutputStream(dest.getAbsolutePath()));
- document.open();
- PdfImportedPage page;
- for (int i = 0; i < pages; ) {
- ++i;
- System.out.println("Processed page " + i);
- page = copy.getImportedPage(reader, i);
- copy.addPage(page);
- }
-
- PRAcroForm form = reader.getAcroForm();
- if (form != null) {
- copy.copyAcroForm(reader);
- }
- document.close();
- }
- catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#valueHasChanged(com.lowagie.tools.arguments.ToolArgument)
- */
- public void valueHasChanged(ToolArgument arg) {
- if (internalFrame == null) {
- // if the internal frame is null, the tool was called from the commandline
- return;
- }
- // represent the changes of the argument in the internal frame
- }
-
- /**
- * Take pages from an existing PDF and copy them in reverse order into a new PDF.
- * @param args
- */
- public static void main(String[] args) {
- ReversePages tool = new ReversePages();
- if (args.length < 2) {
- System.err.println(tool.getUsage());
- }
- tool.setArguments(args);
- tool.execute();
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#getDestPathPDF()
- */
- protected File getDestPathPDF() throws InstantiationException {
- return (File) getValue("destfile");
- }
-} \ No newline at end of file
diff --git a/src/main/java/com/lowagie/tools/plugins/SelectedPages.java b/src/main/java/com/lowagie/tools/plugins/SelectedPages.java
deleted file mode 100644
index 73b3b4f..0000000
--- a/src/main/java/com/lowagie/tools/plugins/SelectedPages.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * $Id: SelectedPages.java,v 1.7 2005/11/29 21:05:02 blowagie Exp $
- * $Name: $
- *
- * This code is free software. It may only be copied or modified
- * if you include the following copyright notice:
- *
- * This class by Mark Thompson. Copyright (c) 2002 Mark Thompson.
- *
- * This code is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * itext-questions@list.sourceforge.net
- */
-package com.lowagie.tools.plugins;
-
-import java.io.File;
-import java.io.FileOutputStream;
-
-import javax.swing.JInternalFrame;
-
-import com.lowagie.text.Document;
-import com.lowagie.text.pdf.PRAcroForm;
-import com.lowagie.text.pdf.PdfCopy;
-import com.lowagie.text.pdf.PdfImportedPage;
-import com.lowagie.text.pdf.PdfReader;
-import com.lowagie.tools.arguments.FileArgument;
-import com.lowagie.tools.arguments.PageSelectorToolArgument;
-import com.lowagie.tools.arguments.PdfFilter;
-import com.lowagie.tools.arguments.ToolArgument;
-
-/**
- * This tool lets you select pages from an existing PDF and copy them into a new PDF.
- */
-public class SelectedPages
- extends AbstractTool {
-
- static {
- addVersion(
- "$Id: SelectedPages.java,v 1.7 2005/11/29 21:05:02 blowagie Exp $");
- }
-
- /**
- * Constructs a SelectedPages object.
- */
- public SelectedPages() {
- menuoptions = MENU_EXECUTE | MENU_EXECUTE_SHOW;
- ToolArgument inputfile = new FileArgument(this, "srcfile",
- "The file you want to split", false,
- new PdfFilter());
- arguments.add(inputfile);
- arguments.add(new FileArgument(this, "destfile",
- "The file to which the first part of the original PDF has to be written", true,
- new PdfFilter()));
- ToolArgument spfpdf = new PageSelectorToolArgument(this, "selection",
- "A selection of pages (see Help for more info)", String.class.getName());
- arguments.add(spfpdf);
- inputfile.addPropertyChangeListener(spfpdf);
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#createFrame()
- */
- protected void createFrame() {
- internalFrame = new JInternalFrame("SelectedPages", true, false, true);
- internalFrame.setSize(300, 80);
- internalFrame.setJMenuBar(getMenubar());
- System.out.println("=== SelectedPages OPENED ===");
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#execute()
- */
- public void execute() {
- try {
- if (getValue("srcfile") == null) {
- throw new InstantiationException("You need to choose a sourcefile");
- }
- File src = (File) getValue("srcfile");
- if (getValue("destfile") == null) {
- throw new InstantiationException(
- "You need to choose a destination file for the first part of the PDF");
- }
- File dest = (File) getValue("destfile");
- String selection = (String) getValue("selection");
-
- // we create a reader for a certain document
- PdfReader reader = new PdfReader(src.getAbsolutePath());
- System.out.println("The original file had " + reader.getNumberOfPages() +
- " pages.");
- reader.selectPages(selection);
- int pages = reader.getNumberOfPages();
- System.err.println("The new file has " + pages + " pages.");
- Document document = new Document(reader.getPageSizeWithRotation(1));
- PdfCopy copy = new PdfCopy(document,
- new FileOutputStream(dest.getAbsolutePath()));
- document.open();
- PdfImportedPage page;
- for (int i = 0; i < pages; ) {
- ++i;
- System.out.println("Processed page " + i);
- page = copy.getImportedPage(reader, i);
- copy.addPage(page);
- }
- PRAcroForm form = reader.getAcroForm();
- if (form != null) {
- copy.copyAcroForm(reader);
- }
- document.close();
- }
- catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#valueHasChanged(com.lowagie.tools.arguments.ToolArgument)
- */
- public void valueHasChanged(ToolArgument arg) {
- if (internalFrame == null) {
- // if the internal frame is null, the tool was called from the commandline
- return;
- }
- // represent the changes of the argument in the internal frame
- System.out.println("klasse:" + arg.getClassname());
- System.out.println("arg:" + arg.getValue());
- }
-
- /**
- * Select pages from an existing PDF and copy them into a new PDF.
- * @param args
- */
- public static void main(String[] args) {
- SelectedPages tool = new SelectedPages();
- if (args.length < 4) {
- System.err.println(tool.getUsage());
- }
- tool.setArguments(args);
- tool.execute();
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#getDestPathPDF()
- */
- protected File getDestPathPDF() throws InstantiationException {
- return (File) getValue("destfile");
- }
-
-}
diff --git a/src/main/java/com/lowagie/tools/plugins/Split.java b/src/main/java/com/lowagie/tools/plugins/Split.java
deleted file mode 100644
index 2c14651..0000000
--- a/src/main/java/com/lowagie/tools/plugins/Split.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * $Id: Split.java,v 1.9 2005/11/29 21:05:02 blowagie Exp $
- * $Name: $
- *
- * This code is free software. It may only be copied or modified
- * if you include the following copyright notice:
- *
- * This class by Mark Thompson. Copyright (c) 2002 Mark Thompson.
- *
- * This code is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * itext-questions@list.sourceforge.net
- */
-package com.lowagie.tools.plugins;
-
-import java.io.File;
-import java.io.FileOutputStream;
-
-import javax.swing.JInternalFrame;
-
-import com.lowagie.text.Document;
-import com.lowagie.text.DocumentException;
-import com.lowagie.text.pdf.PdfContentByte;
-import com.lowagie.text.pdf.PdfImportedPage;
-import com.lowagie.text.pdf.PdfReader;
-import com.lowagie.text.pdf.PdfWriter;
-import com.lowagie.tools.arguments.FileArgument;
-import com.lowagie.tools.arguments.LabelAccessory;
-import com.lowagie.tools.arguments.PdfFilter;
-import com.lowagie.tools.arguments.ToolArgument;
-
-/**
- * This tool lets you split a PDF in two separate PDF files.
- */
-public class Split extends AbstractTool {
-
- static {
- addVersion("$Id: Split.java,v 1.9 2005/11/29 21:05:02 blowagie Exp $");
- }
- /**
- * Constructs an Split object.
- */
- public Split() {
- FileArgument f = new FileArgument(this, "srcfile", "The file you want to split", false, new PdfFilter());
- f.setLabel(new LabelAccessory());
- arguments.add(f);
- arguments.add(new FileArgument(this, "destfile1", "The file to which the first part of the original PDF has to be written", true, new PdfFilter()));
- arguments.add(new FileArgument(this, "destfile2", "The file to which the second part of the original PDF has to be written", true, new PdfFilter()));
- arguments.add(new ToolArgument(this, "pagenumber", "The pagenumber where you want to split", String.class.getName()));
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#createFrame()
- */
- protected void createFrame() {
- internalFrame = new JInternalFrame("Split", true, false, true);
- internalFrame.setSize(300, 80);
- internalFrame.setJMenuBar(getMenubar());
- System.out.println("=== Split OPENED ===");
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#execute()
- */
- public void execute() {
- try {
- if (getValue("srcfile") == null) throw new InstantiationException("You need to choose a sourcefile");
- File src = (File)getValue("srcfile");
- if (getValue("destfile1") == null) throw new InstantiationException("You need to choose a destination file for the first part of the PDF");
- File file1 = (File)getValue("destfile1");
- if (getValue("destfile2") == null) throw new InstantiationException("You need to choose a destination file for the second part of the PDF");
- File file2 = (File)getValue("destfile2");
- int pagenumber = Integer.parseInt((String)getValue("pagenumber"));
-
- // we create a reader for a certain document
- PdfReader reader = new PdfReader(src.getAbsolutePath());
- // we retrieve the total number of pages
- int n = reader.getNumberOfPages();
- System.out.println("There are " + n + " pages in the original file.");
-
- if (pagenumber < 2 || pagenumber > n) {
- throw new DocumentException("You can't split this document at page " + pagenumber + "; there is no such page.");
- }
-
- // step 1: creation of a document-object
- Document document1 = new Document(reader.getPageSizeWithRotation(1));
- Document document2 = new Document(reader.getPageSizeWithRotation(pagenumber));
- // step 2: we create a writer that listens to the document
- PdfWriter writer1 = PdfWriter.getInstance(document1, new FileOutputStream(file1));
- PdfWriter writer2 = PdfWriter.getInstance(document2, new FileOutputStream(file2));
- // step 3: we open the document
- document1.open();
- PdfContentByte cb1 = writer1.getDirectContent();
- document2.open();
- PdfContentByte cb2 = writer2.getDirectContent();
- PdfImportedPage page;
- int rotation;
- int i = 0;
- // step 4: we add content
- while (i < pagenumber - 1) {
- i++;
- document1.setPageSize(reader.getPageSizeWithRotation(i));
- document1.newPage();
- page = writer1.getImportedPage(reader, i);
- rotation = reader.getPageRotation(i);
- if (rotation == 90 || rotation == 270) {
- cb1.addTemplate(page, 0, -1f, 1f, 0, 0, reader.getPageSizeWithRotation(i).height());
- }
- else {
- cb1.addTemplate(page, 1f, 0, 0, 1f, 0, 0);
- }
- }
- while (i < n) {
- i++;
- document2.setPageSize(reader.getPageSizeWithRotation(i));
- document2.newPage();
- page = writer2.getImportedPage(reader, i);
- rotation = reader.getPageRotation(i);
- if (rotation == 90 || rotation == 270) {
- cb2.addTemplate(page, 0, -1f, 1f, 0, 0, reader.getPageSizeWithRotation(i).height());
- }
- else {
- cb2.addTemplate(page, 1f, 0, 0, 1f, 0, 0);
- }
- }
- // step 5: we close the document
- document1.close();
- document2.close();
- }
- catch(Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#valueHasChanged(com.lowagie.tools.arguments.ToolArgument)
- */
- public void valueHasChanged(ToolArgument arg) {
- if (internalFrame == null) {
- // if the internal frame is null, the tool was called from the commandline
- return;
- }
- // represent the changes of the argument in the internal frame
- }
-
-
- /**
- * Split a PDF in two separate PDF files.
- * @param args
- */
- public static void main(String[] args) {
- Split tool = new Split();
- if (args.length < 4) {
- System.err.println(tool.getUsage());
- }
- tool.setArguments(args);
- tool.execute();
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#getDestPathPDF()
- */
- protected File getDestPathPDF() throws InstantiationException {
- return (File)getValue("destfile1");
- }
-}
diff --git a/src/main/java/com/lowagie/tools/plugins/Tiff2Pdf.java b/src/main/java/com/lowagie/tools/plugins/Tiff2Pdf.java
deleted file mode 100644
index 8455cdf..0000000
--- a/src/main/java/com/lowagie/tools/plugins/Tiff2Pdf.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * $Id: Tiff2Pdf.java,v 1.9 2005/11/29 21:05:02 blowagie Exp $
- * $Name: $
- *
- * Copyright 2005 by Bruno Lowagie.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (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.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.tools.plugins;
-
-import java.io.File;
-import java.io.FileOutputStream;
-
-import javax.swing.JInternalFrame;
-import javax.swing.JOptionPane;
-
-import com.lowagie.text.Document;
-import com.lowagie.text.Image;
-import com.lowagie.text.PageSize;
-import com.lowagie.text.Paragraph;
-import com.lowagie.text.Rectangle;
-import com.lowagie.text.pdf.PdfContentByte;
-import com.lowagie.text.pdf.PdfWriter;
-import com.lowagie.text.pdf.RandomAccessFileOrArray;
-import com.lowagie.text.pdf.codec.TiffImage;
-import com.lowagie.tools.arguments.FileArgument;
-import com.lowagie.tools.arguments.ImageFilter;
-import com.lowagie.tools.arguments.OptionArgument;
-import com.lowagie.tools.arguments.PdfFilter;
-import com.lowagie.tools.arguments.ToolArgument;
-
-/**
- * Converts a Tiff file to a PDF file.
- */
-public class Tiff2Pdf extends AbstractTool {
-
- static {
- addVersion("$Id: Tiff2Pdf.java,v 1.9 2005/11/29 21:05:02 blowagie Exp $");
- }
- /**
- * Constructs a Tiff2Pdf object.
- */
- public Tiff2Pdf() {
- menuoptions = MENU_EXECUTE | MENU_EXECUTE_SHOW;
- arguments.add(new FileArgument(this, "srcfile", "The file you want to convert", false, new ImageFilter(false, false, false, false, false, true)));
- arguments.add(new FileArgument(this, "destfile", "The file to which the converted TIFF has to be written", true, new PdfFilter()));
- OptionArgument oa = new OptionArgument(this, "pagesize", "Pagesize");
- oa.addOption("A4", "A4");
- oa.addOption("Letter", "LETTER");
- oa.addOption("Original format", "ORIGINAL");
- arguments.add(oa);
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#createFrame()
- */
- protected void createFrame() {
- internalFrame = new JInternalFrame("Tiff2Pdf", true, false, true);
- internalFrame.setSize(550, 250);
- internalFrame.setJMenuBar(getMenubar());
- System.out.println("=== Tiff2Pdf OPENED ===");
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#execute()
- */
- public void execute() {
- try {
- if (getValue("srcfile") == null) throw new InstantiationException("You need to choose a sourcefile");
- File tiff_file = (File)getValue("srcfile");
- if (getValue("destfile") == null) throw new InstantiationException("You need to choose a destination file");
- File pdf_file = (File)getValue("destfile");
- RandomAccessFileOrArray ra = new RandomAccessFileOrArray(tiff_file.getAbsolutePath());
- int comps = TiffImage.getNumberOfPages(ra);
- boolean adjustSize = false;
- Document document = new Document(PageSize.A4);
- if ("ORIGINAL".equals(getValue("pagesize"))) {
- Image img = TiffImage.getTiffImage(ra, 1);
- document.setPageSize(new Rectangle(img.scaledWidth(), img.scaledHeight()));
- adjustSize = true;
- }
- else if ("LETTER".equals(getValue("pagesize"))) {
- document.setPageSize(PageSize.LETTER);
- }
- PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(pdf_file));
- document.open();
- PdfContentByte cb = writer.getDirectContent();
- for (int c = 0; c < comps; ++c) {
- Image img = TiffImage.getTiffImage(ra, c + 1);
- if (img != null) {
- if (adjustSize) {
- document.setPageSize(new Rectangle(img.scaledWidth(),
- img.scaledHeight()));
- document.newPage();
- img.setAbsolutePosition(0, 0);
- }
- else {
- if (img.scaledWidth() > 500 || img.scaledHeight() > 700) {
- img.scaleToFit(500, 700);
- }
- img.setAbsolutePosition(20, 20);
- document.newPage();
- document.add(new Paragraph(tiff_file + " - page " + (c + 1)));
- }
- cb.addImage(img);
- System.out.println("Finished page " + (c + 1));
- }
- }
- ra.close();
- document.close();
- } catch (Exception e) {
- JOptionPane.showMessageDialog(internalFrame,
- e.getMessage(),
- e.getClass().getName(),
- JOptionPane.ERROR_MESSAGE);
- System.err.println(e.getMessage());
- }
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#valueHasChanged(com.lowagie.tools.arguments.ToolArgument)
- */
- public void valueHasChanged(ToolArgument arg) {
- if (internalFrame == null) {
- // if the internal frame is null, the tool was called from the commandline
- return;
- }
- // represent the changes of the argument in the internal frame
- }
-
-
- /**
- * Converts a tiff file to PDF.
- * @param args
- */
- public static void main(String[] args) {
- Tiff2Pdf tool = new Tiff2Pdf();
- if (args.length < 2) {
- System.err.println(tool.getUsage());
- }
- tool.setArguments(args);
- tool.execute();
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#getDestPathPDF()
- */
- protected File getDestPathPDF() throws InstantiationException {
- return (File)getValue("destfile");
- }
-} \ No newline at end of file
diff --git a/src/main/java/com/lowagie/tools/plugins/TreeViewPDF.java b/src/main/java/com/lowagie/tools/plugins/TreeViewPDF.java
deleted file mode 100644
index 0b55b8c..0000000
--- a/src/main/java/com/lowagie/tools/plugins/TreeViewPDF.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * $Id: TreeViewPDF.java,v 1.2 2006/05/29 10:31:17 blowagie Exp $
- * $Name: $
- *
- * Copyright 2005 by Anonymous.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (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.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.tools.plugins;
-
-import java.io.File;
-
-import javax.swing.JOptionPane;
-
-import com.lowagie.tools.arguments.FileArgument;
-import com.lowagie.tools.arguments.LabelAccessory;
-import com.lowagie.tools.arguments.PdfFilter;
-import com.lowagie.tools.arguments.ToolArgument;
-import com.lowagie.tools.plugins.treeview.TreeViewInternalFrame;
-import com.lowagie.tools.Toolbox;
-import java.beans.*;
-
-/**
- * Allows you to inspect an existing PDF file.
- */
-public class TreeViewPDF
- extends AbstractTool {
- static {
- addVersion("$Id: TreeViewPDF.java,v 1.2 2006/05/29 10:31:17 blowagie Exp $");
- }
-
- TreeViewInternalFrame ul;
- FileArgument inputfile;
- /**
- * Constructs an TreeViewPDF object.
- */
- public TreeViewPDF() {
- inputfile = new FileArgument(this, "srcfile",
- "The file you want to inspect", false,
- new PdfFilter());
- inputfile.setLabel(new LabelAccessory());
- arguments.add(inputfile);
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#createFrame()
- */
- protected void createFrame() {
- ul = new TreeViewInternalFrame("Pdf Analysis", true, false, true);
- internalFrame = ul;
- internalFrame.setSize(500, 300);
- internalFrame.setJMenuBar(getMenubar());
- inputfile.addPropertyChangeListener(ul);
- System.out.println("=== Pdf Analysis OPENED ===");
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#execute()
- */
- public void execute() {
- try {
- if (getValue("srcfile") == null) {
- throw new InstantiationException("You need to choose a sourcefile");
- }
-
- }
- catch (Exception e) {
- JOptionPane.showMessageDialog(internalFrame,
- e.getMessage(),
- e.getClass().getName(),
- JOptionPane.ERROR_MESSAGE);
- System.err.println(e.getMessage());
- }
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#valueHasChanged(com.lowagie.tools.arguments.ToolArgument)
- */
- public void valueHasChanged(ToolArgument arg) {
- if (internalFrame == null) {
- // if the internal frame is null, the tool was called from the commandline
- return;
- }
- // represent the changes of the argument in the internal frame
- }
-
- /**
- * Inspects an existing PDF file.
- * @param args
- */
- public static void main(String[] args) {
- try {
- Toolbox toolbox = new Toolbox();
- AbstractTool tool = toolbox.createFrame("TreeViewPDF");
- if (args.length > 1) {
- System.err.println(tool.getUsage());
- }
- tool.setArguments(args);
- tool.execute();
- }
- catch (PropertyVetoException ex) {
- }
- catch (ClassNotFoundException ex) {
- }
- catch (IllegalAccessException ex) {
- }
- catch (InstantiationException ex) {
- }
-// throw new RuntimeException("GUI only Application!");
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#getDestPathPDF()
- */
- protected File getDestPathPDF() throws InstantiationException {
- throw new InstantiationException("There is no file to show.");
- }
-
-}
diff --git a/src/main/java/com/lowagie/tools/plugins/Txt2Pdf.java b/src/main/java/com/lowagie/tools/plugins/Txt2Pdf.java
deleted file mode 100644
index 8a377fd..0000000
--- a/src/main/java/com/lowagie/tools/plugins/Txt2Pdf.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * $Id: Txt2Pdf.java,v 1.9 2005/11/29 21:05:02 blowagie Exp $
- * $Name: $
- *
- * Copyright 2005 by Bruno Lowagie.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (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.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.tools.plugins;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.FileReader;
-
-import javax.swing.JInternalFrame;
-import javax.swing.JOptionPane;
-
-import com.lowagie.text.Document;
-import com.lowagie.text.Font;
-import com.lowagie.text.FontFactory;
-import com.lowagie.text.Paragraph;
-import com.lowagie.text.Rectangle;
-import com.lowagie.text.pdf.PdfWriter;
-import com.lowagie.tools.arguments.FileArgument;
-import com.lowagie.tools.arguments.OptionArgument;
-import com.lowagie.tools.arguments.PageSizeArgument;
-import com.lowagie.tools.arguments.PdfFilter;
-import com.lowagie.tools.arguments.ToolArgument;
-
-/**
- * Converts a monospaced txt file to a PDF file.
- */
-public class Txt2Pdf extends AbstractTool {
-
- static {
- addVersion("$Id: Txt2Pdf.java,v 1.9 2005/11/29 21:05:02 blowagie Exp $");
- }
- /**
- * Constructs a Txt2Pdf object.
- */
- public Txt2Pdf() {
- menuoptions = MENU_EXECUTE | MENU_EXECUTE_SHOW | MENU_EXECUTE_PRINT_SILENT;
- arguments.add(new FileArgument(this, "srcfile", "The file you want to convert", false));
- arguments.add(new FileArgument(this, "destfile", "The file to which the converted text has to be written", true, new PdfFilter()));
- PageSizeArgument oa1 = new PageSizeArgument(this, "pagesize", "Pagesize");
- arguments.add(oa1);
- OptionArgument oa2 = new OptionArgument(this, "orientation", "Orientation of the page");
- oa2.addOption("Portrait", "PORTRAIT");
- oa2.addOption("Landscape", "LANDSCAPE");
- arguments.add(oa2);
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#createFrame()
- */
- protected void createFrame() {
- internalFrame = new JInternalFrame("Txt2Pdf", true, true, true);
- internalFrame.setSize(300, 80);
- internalFrame.setJMenuBar(getMenubar());
- System.out.println("=== Txt2Pdf OPENED ===");
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#execute()
- */
- public void execute() {
- try {
- String line = null;
- Document document;
- Font f;
- Rectangle pagesize = (Rectangle)getValue("pagesize");
- if ("LANDSCAPE".equals(getValue("orientation"))) {
- f = FontFactory.getFont(FontFactory.COURIER, 10);
- document = new Document(pagesize.rotate(), 36, 9, 36, 36);
- }
- else {
- f = FontFactory.getFont(FontFactory.COURIER, 11);
- document = new Document(pagesize, 72, 36, 36, 36);
- }
- BufferedReader in = new BufferedReader(new FileReader((File)getValue("srcfile")));
- PdfWriter.getInstance(document, new FileOutputStream((File)getValue("destfile")));
- document.open();
- while ((line = in.readLine()) != null) {
- document.add(new Paragraph(12, line, f));
- }
- document.close();
- } catch (Exception e) {
- JOptionPane.showMessageDialog(internalFrame,
- e.getMessage(),
- e.getClass().getName(),
- JOptionPane.ERROR_MESSAGE);
- System.err.println(e.getMessage());
- }
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#valueHasChanged(com.lowagie.tools.arguments.ToolArgument)
- */
- public void valueHasChanged(ToolArgument arg) {
- if (internalFrame == null) {
- // if the internal frame is null, the tool was called from the commandline
- return;
- }
- // represent the changes of the argument in the internal frame
- }
-
-
- /**
- * Converts a monospaced txt file to a PDF file.
- * @param args
- */
- public static void main(String[] args) {
- Txt2Pdf tool = new Txt2Pdf();
- if (args.length < 3) {
- System.err.println(tool.getUsage());
- }
- tool.setArguments(args);
- tool.execute();
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#getDestPathPDF()
- */
- protected File getDestPathPDF() throws InstantiationException {
- return (File)getValue("destfile");
- }
-}
diff --git a/src/main/java/com/lowagie/tools/plugins/Watermarker.java b/src/main/java/com/lowagie/tools/plugins/Watermarker.java
deleted file mode 100644
index e1e64f8..0000000
--- a/src/main/java/com/lowagie/tools/plugins/Watermarker.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * $Id: Watermarker.java,v 1.6 2006/03/20 14:30:33 blowagie Exp $
- * $Name: $
- *
- * This code is free software. It may only be copied or modified
- * if you include the following copyright notice:
- *
- * This class by Carsten hammer and Bruno Lowagie.
- * Copyright (c) 2005 Carsten Hammer and Bruno Lowagie.
- *
- * This code is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * itext-questions@list.sourceforge.net
- */
-
-package com.lowagie.tools.plugins;
-
-import java.io.*;
-
-import javax.swing.*;
-
-import com.lowagie.text.*;
-import com.lowagie.text.pdf.*;
-import com.lowagie.tools.arguments.*;
-
-/**
- * This tool lets you add a text watermark to all pages of a document.
- */
-public class Watermarker extends AbstractTool {
-
- static {
- addVersion("$Id: Watermarker.java,v 1.6 2006/03/20 14:30:33 blowagie Exp $");
- }
-
- /**
- * This tool lets you add a text watermark to all pages of a document.
- */
- public Watermarker() {
- super();
- arguments.add(new FileArgument(this, "srcfile",
- "The file you want to watermark", false, new PdfFilter()));
- arguments.add(new ToolArgument(this, "watermark", "The text that can be used as watermark", String.class.getName()));
- arguments.add(new ToolArgument(this, "fontsize", "The fontsize of the watermark text", String.class.getName()));
- arguments.add(new ToolArgument(this, "opacity", "The opacity of the watermark text", String.class.getName()));
- arguments.add(new FileArgument(this, "destfile",
- "The file to which the watermarked PDF has to be written",
- true, new PdfFilter()));
-
- }
-
- /**
- * Creates the internal frame.
- */
- protected void createFrame() {
- internalFrame = new JInternalFrame("Watermark", true, false, true);
- internalFrame.setSize(300, 80);
- internalFrame.setJMenuBar(getMenubar());
- System.out.println("=== Watermark OPENED ===");
- }
-
- /**
- * Executes the tool (in most cases this generates a PDF file).
- */
- public void execute() {
- try {
- if (getValue("srcfile") == null) {
- throw new InstantiationException(
- "You need to choose a sourcefile");
- }
- if (getValue("destfile") == null) {
- throw new InstantiationException(
- "You need to choose a destination file");
- }
- if (getValue("watermark") == null) {
- throw new InstantiationException(
- "You need to add a text for the watermark");
- }
- int fontsize = Integer.parseInt((String)getValue("fontsize"));
- float opacity = Float.parseFloat((String)getValue("opacity"));
- BaseFont bf = BaseFont.createFont("Helvetica", BaseFont.WINANSI,
- false);
- PdfReader reader = new PdfReader(((File) getValue("srcfile"))
- .getAbsolutePath());
- int pagecount = reader.getNumberOfPages();
- PdfGState gs1 = new PdfGState();
- gs1.setFillOpacity(opacity);
- String text = (String)getValue("watermark");
- PdfStamper stamp = new PdfStamper(reader, new FileOutputStream(
- (File) getValue("destfile")));
- float txtwidth = bf.getWidthPoint(text, fontsize);
- for (int i = 1; i <= pagecount; i++) {
- PdfContentByte seitex = stamp.getOverContent(i);
- Rectangle recc = reader.getCropBox(i);
- float winkel = (float) Math.atan(recc.height() / recc.width());
- float m1 = (float) Math.cos(winkel);
- float m2 = (float) -Math.sin(winkel);
- float m3 = (float) Math.sin(winkel);
- float m4 = (float) Math.cos(winkel);
- float xoff = (float) (-Math.cos(winkel) * txtwidth / 2 - Math
- .sin(winkel)
- * fontsize / 2);
- float yoff = (float) (Math.sin(winkel) * txtwidth / 2 - Math
- .cos(winkel)
- * fontsize / 2);
- seitex.saveState();
- seitex.setGState(gs1);
- seitex.beginText();
- seitex.setFontAndSize(bf, fontsize);
- seitex.setTextMatrix(m1, m2, m3, m4, xoff + recc.width() / 2,
- yoff + recc.height() / 2);
- seitex.showText(text);
- seitex.endText();
- seitex.restoreState();
- }
- stamp.close();
- } catch (Exception e) {
- JOptionPane.showMessageDialog(internalFrame, e.getMessage(), e
- .getClass().getName(), JOptionPane.ERROR_MESSAGE);
- System.err.println(e.getMessage());
- }
- }
-
- /**
- * Gets the PDF file that should be generated (or null if the output isn't a
- * PDF file).
- *
- * @return the PDF file that should be generated
- * @throws InstantiationException
- */
- protected File getDestPathPDF() throws InstantiationException {
- return (File) getValue("destfile");
- }
-
- /**
- * Indicates that the value of an argument has changed.
- *
- * @param arg
- * the argument that has changed
- */
- public void valueHasChanged(ToolArgument arg) {
- if (internalFrame == null) {
- // if the internal frame is null, the tool was called from the
- // commandline
- return;
- }
-
- }
-
- /**
- * This methods helps you running this tool as a standalone application.
- * @param args the srcfile, watermark text and destfile
- */
- public static void main(String[] args) {
- Watermarker watermarker = new Watermarker();
- if (args.length != 5) {
- System.err.println(watermarker.getUsage());
- }
- watermarker.setArguments(args);
- watermarker.execute();
- }
-} \ No newline at end of file
diff --git a/src/main/java/com/lowagie/tools/plugins/XML2Bookmarks.java b/src/main/java/com/lowagie/tools/plugins/XML2Bookmarks.java
deleted file mode 100644
index 9b23657..0000000
--- a/src/main/java/com/lowagie/tools/plugins/XML2Bookmarks.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * $Id: XML2Bookmarks.java,v 1.2 2006/02/03 08:30:56 blowagie Exp $
- * $Name: $
- *
- * Copyright 2005 by Hans-Werner Hilse.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (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.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.tools.plugins;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.util.List;
-
-import javax.swing.JInternalFrame;
-import javax.swing.JOptionPane;
-
-import com.lowagie.text.pdf.PdfReader;
-import com.lowagie.text.pdf.PdfStamper;
-import com.lowagie.text.pdf.PdfWriter;
-import com.lowagie.text.pdf.SimpleBookmark;
-import com.lowagie.tools.arguments.FileArgument;
-import com.lowagie.tools.arguments.PdfFilter;
-import com.lowagie.tools.arguments.ToolArgument;
-
-/**
- * Allows you to add bookmarks to an existing PDF file
- */
-public class XML2Bookmarks extends AbstractTool {
-
- static {
- addVersion("$Id: XML2Bookmarks.java,v 1.2 2006/02/03 08:30:56 blowagie Exp $");
- }
-
- /**
- * Constructs an XML2Bookmarks object.
- */
- public XML2Bookmarks() {
- arguments.add(new FileArgument(this, "xmlfile", "the bookmarks in XML", false));
- arguments.add(new FileArgument(this, "pdffile", "the PDF to which you want to add bookmarks", false, new PdfFilter()));
- arguments.add(new FileArgument(this, "destfile", "the resulting PDF", true, new PdfFilter()));
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#createFrame()
- */
- protected void createFrame() {
- internalFrame = new JInternalFrame("XML + PDF = PDF", true, true, true);
- internalFrame.setSize(300, 80);
- internalFrame.setJMenuBar(getMenubar());
- System.out.println("=== XML2Bookmarks OPENED ===");
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#execute()
- */
- public void execute() {
- try {
- if (getValue("xmlfile") == null) throw new InstantiationException("You need to choose an xml file");
- if (getValue("pdffile") == null) throw new InstantiationException("You need to choose a source PDF file");
- if (getValue("destfile") == null) throw new InstantiationException("You need to choose a destination PDF file");
- FileInputStream bmReader = new FileInputStream( (File) getValue("xmlfile") );
- List bookmarks = SimpleBookmark.importFromXML( bmReader );
- bmReader.close();
- PdfReader reader = new PdfReader(((File)getValue("pdffile")).getAbsolutePath());
- reader.consolidateNamedDestinations();
- int n = reader.getNumberOfPages();
- PdfStamper stamper = new PdfStamper(reader, new FileOutputStream((File)getValue("destfile")));
- stamper.setOutlines(bookmarks);
- stamper.setViewerPreferences(reader.getViewerPreferences() | PdfWriter.PageModeUseOutlines);
- stamper.close();
- }
- catch(Exception e) {
- e.printStackTrace();
- JOptionPane.showMessageDialog(internalFrame,
- e.getMessage(),
- e.getClass().getName(),
- JOptionPane.ERROR_MESSAGE);
- System.err.println(e.getMessage());
- }
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#valueHasChanged(com.lowagie.tools.arguments.ToolArgument)
- */
- public void valueHasChanged(ToolArgument arg) {
- if (internalFrame == null) {
- // if the internal frame is null, the tool was called from the commandline
- return;
- }
- // represent the changes of the argument in the internal frame
- }
-
- /**
- * Allows you to generate an index file in HTML containing Bookmarks to an existing PDF file.
- * @param args
- */
- public static void main(String[] args) {
- XML2Bookmarks tool = new XML2Bookmarks();
- if (args.length < 3) {
- System.err.println(tool.getUsage());
- }
- tool.setArguments(args);
- tool.execute();
- }
-
- /**
- * @see com.lowagie.tools.plugins.AbstractTool#getDestPathPDF()
- */
- protected File getDestPathPDF() throws InstantiationException {
- return (File)getValue("destfile");
- }
-
-}
diff --git a/src/main/java/com/lowagie/tools/plugins/treeview/AnalyzePDF.java b/src/main/java/com/lowagie/tools/plugins/treeview/AnalyzePDF.java
deleted file mode 100644
index 5907f9a..0000000
--- a/src/main/java/com/lowagie/tools/plugins/treeview/AnalyzePDF.java
+++ /dev/null
@@ -1,507 +0,0 @@
-/*
- * $Id: AnalyzePDF.java,v 1.4 2006/05/30 09:11:45 blowagie Exp $
- * $Name: $
- *
- * Copyright 2005 by Anonymous.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (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.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.tools.plugins.treeview;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Vector;
-
-import javax.swing.event.TreeModelEvent;
-import javax.swing.event.TreeModelListener;
-import javax.swing.tree.DefaultMutableTreeNode;
-import javax.swing.tree.TreeModel;
-import javax.swing.tree.TreePath;
-
-import com.lowagie.text.pdf.*;
-import java.util.Set;
-import java.util.Iterator;
-import javax.swing.table.TableModel;
-import javax.swing.table.AbstractTableModel;
-
-public class AnalyzePDF
- extends Thread implements TreeModel, ICommonAnalyzer {
- DefaultMutableTreeNode root;
- DefaultMutableTreeNode filenode;
- int pagecount;
- ProgressDialog progressdialog;
- int numberofpages;
- ArrayList pageInh = new ArrayList();
- private transient Vector treeModelListeners;
- PdfReader reader;
-
- public AnalyzePDF(String infile,
- com.lowagie.tools.plugins.treeview.ProgressDialog blubb) {
- this.progressdialog = blubb;
- try {
- reader = new PdfReader(infile);
- root = new SimpletextTreeNode("Dokument");
- filenode = new FileTreeNode(infile, reader);
- root.add(filenode);
- this.numberofpages = reader.getNumberOfPages();
- }
- catch (IOException ex) {
- }
- pagecount = 0;
- }
-
- public TableModel getXReftable() {
- TableModel tm = new AbstractTableModel() {
- public int getColumnCount() {
- return 2;
- }
-
- public int getRowCount() {
- return reader.getXrefSize() - 1;
- }
-
- public Object getValueAt(int rowIndex, int columnIndex) {
- switch (columnIndex) {
- case 0:
- return new Integer(rowIndex + 1);
- case 1:
- PdfObject pdfob=reader.getPdfObject(rowIndex + 1);
- if(pdfob.isStream()){
- return "Stream "+pdfob;
- }else{
- return pdfob;
- }
- default:
- return null;
- }
- }
-
- /**
- * Returns the name of the column at <code>columnIndex</code>.
- *
- * @param columnIndex the index of the column
- * @return the name of the column
- * @todo Implement this javax.swing.table.TableModel method
- */
- public String getColumnName(int columnIndex) {
- switch (columnIndex) {
- case 0:
- return "XRefNr";
- case 1:
- return "Object";
- default:
- return null;
- }
-
- }
- };
- return tm;
- }
-
- /**
- * Walk down the Pagetree
- * @param page PdfDictionary
- * @param pdfreader PdfReader
- * @param count_in_leaf int
- * @param node DefaultMutableTreeNode
- */
- protected void iteratePages(PdfDictionary page, PdfReader pdfreader,
- DefaultMutableTreeNode node) {
- DefaultMutableTreeNode leaf;
-
- PdfArray kidsPR = (PdfArray) PdfReader.getPdfObject(page.get(PdfName.KIDS));
- if (kidsPR == null) {
- node.add(new Pagetreenode(page, pagecount, this, pdfreader));
- System.out.println("Page= " + (pagecount + 1));
- pageInh.add(pagecount, page);
- pagecount++;
- }
- else {
- leaf = new PagelistTreeNode(kidsPR);
- node.add(leaf);
- page.put(PdfName.TYPE, PdfName.PAGES);
- ArrayList kids = kidsPR.getArrayList();
- for (int k = 0; k < kids.size(); ++k) {
- PdfDictionary kid = (PdfDictionary) PdfReader.getPdfObject( (
- PRIndirectReference) kids.get(k));
- iteratePages(kid, pdfreader, leaf);
- }
- }
- }
-
- protected void iterateOutlines(PdfDictionary outlines, PdfReader pdfreader,
- DefaultMutableTreeNode node) {
- DefaultMutableTreeNode leaf;
- PdfDictionary kid = outlines;
- do {
- PdfString title = (PdfString) pdfreader.getPdfObject(
- kid.get(PdfName.TITLE));
- leaf = new OutlinelistTreeNode(title, kid);
- node.add(leaf);
- PdfDictionary first = (PdfDictionary) PdfReader.getPdfObject( (
- PRIndirectReference) kid.get(PdfName.FIRST));
- if (first != null) {
- iterateOutlines(first, pdfreader, leaf);
- }
- else {
- PdfDictionary se = (PdfDictionary) PdfReader.getPdfObject( (
- PRIndirectReference) kid.get(new PdfName("SE")));
- if (se != null) {
- iterateObjects(se, pdfreader, leaf);
- }
- PdfObject dest = (PdfObject) pdfreader.getPdfObject(kid.get(PdfName.
- DEST));
- if (dest != null) {
- iterateObjects(dest, pdfreader, leaf);
- }
- PdfObject a = (PdfObject) pdfreader.getPdfObject(kid.get(PdfName.A));
- if (a != null) {
- iterateObjects(a, pdfreader, leaf);
- }
- }
- }
- while ( (kid = (PdfDictionary) pdfreader.getPdfObject(kid.get(PdfName.NEXT))) != null);
- }
-
- /**
- * Recursive investigate PDF Objecttree (other than pagetree objects!)
- * @param pdfobj PdfObject
- * @param pdfreader PdfReader
- * @param node DefaultMutableTreeNode
- */
- public void iterateObjects(PdfObject pdfobj, PdfReader pdfreader,
- DefaultMutableTreeNode node) {
- DefaultMutableTreeNode leaf;
- if (pdfobj.isDictionary()) {
- leaf = new DictionaryTreeNode("PdfDictionary " + pdfobj,
- (PdfDictionary) pdfobj);
- node.add(leaf);
- Set s = ( (PdfDictionary) pdfobj).getKeys();
- Iterator it = s.iterator();
- int i = 0;
- while (it.hasNext()) {
- i++;
- Object obj = it.next();
-// System.out.println("Feld:" + obj);
-
- PdfObject value = PdfReader.getPdfObject( ( (PdfDictionary) pdfobj).get( (
- PdfName) obj));
-// System.out.println("Value:" + value);
- SimpletextTreeNode sttn = new SimpletextTreeNode(obj + " " + value);
- leaf.add(sttn);
- if (obj.equals(PdfName.PARENT)) {
- continue;
- }
- if (value != null) {
- iterateObjects(value, pdfreader, sttn);
- }
- }
- }
- else if (pdfobj.isArray()) {
- leaf = new ArrayTreeNode("PdfArray " + pdfobj, (PdfArray) pdfobj);
- node.add(leaf);
- ArrayList kids = ( (PdfArray) pdfobj).getArrayList();
- for (int k = 0; k < kids.size(); ++k) {
- PdfObject curkid = (PdfObject) kids.get(k);
- if (curkid.isIndirect()) {
- PdfObject kid = PdfReader.getPdfObject( (
- PRIndirectReference) kids.get(k));
- if (kid != null) {
- iterateObjects(kid, pdfreader, leaf);
- }
- }
- else if (curkid.isNumber()) {
-
- }
- else {
- PdfObject kid = (PdfObject) kids.get(k);
- iterateObjects(kid, pdfreader, leaf);
- }
- }
- }
- else if (pdfobj.isIndirect()) {
- leaf = new SimpletextTreeNode("PRIndirectReference " + pdfobj);
- node.add(leaf);
- PdfObject target = PdfReader.getPdfObject( (
- PRIndirectReference) pdfobj);
- if (target != null) {
- iterateObjects(target, pdfreader, leaf);
- }
- }
- else if (pdfobj.isBoolean()) {
-// leaf = new SimpletextTreeNode("Boolean " + pdfobj);
-// node.add(leaf);
- }
- else if (pdfobj.isName()) {
-// leaf = new SimpletextTreeNode("Name " + pdfobj);
-// node.add(leaf);
- }
- else if (pdfobj.isNull()) {
-// leaf = new SimpletextTreeNode("Null " + pdfobj);
-// node.add(leaf);
- }
- else if (pdfobj.isNumber()) {
-// leaf = new SimpletextTreeNode("Number " + pdfobj);
-// node.add(leaf);
- }
- else if (pdfobj.isString()) {
-// leaf = new SimpletextTreeNode("String " + pdfobj);
-// node.add(leaf);
- }
- else if (pdfobj.isStream()) {
- leaf = new TextpaneTreeNode(pdfobj,"Stream");
- node.add(leaf);
- leaf = new DictionaryTreeNode("PdfDictionary " + pdfobj,
- (PdfDictionary) pdfobj);
- node.add(leaf);
- Set s = ( (PdfDictionary) pdfobj).getKeys();
- Iterator it = s.iterator();
- int i = 0;
- while (it.hasNext()) {
- i++;
- Object obj = it.next();
-// System.out.println("Feld:" + obj);
-
- PdfObject value = PdfReader.getPdfObject( ( (PdfDictionary) pdfobj).get( (
- PdfName) obj));
-// System.out.println("Value:" + value);
- SimpletextTreeNode sttn = new SimpletextTreeNode(obj + " " + value);
- leaf.add(sttn);
- if (obj.equals(PdfName.PARENT)) {
- continue;
- }
- if (value != null) {
- iterateObjects(value, pdfreader, sttn);
- }
- }
-
- }
-
- else {
- leaf = new SimpletextTreeNode("Unknown " + pdfobj);
- node.add(leaf);
- }
-
- }
-
- /**
- * Returns the root of the tree.
- *
- * @return the root of the tree
- * @todo Diese javax.swing.tree.TreeModel-Methode implementieren
- */
- public Object getRoot() {
- return root;
- }
-
- /**
- * Returns the child of <code>parent</code> at index <code>index</code> in the
- * parent's child array.
- *
- * @param parent a node in the tree, obtained from this data source
- * @param index int
- * @return the child of <code>parent</code> at index <code>index</code>
- * @todo Diese javax.swing.tree.TreeModel-Methode implementieren
- */
- public Object getChild(Object parent, int index) {
- DefaultMutableTreeNode node = (DefaultMutableTreeNode) parent;
- return node.getChildAt(index);
- }
-
- /**
- * Returns the number of children of <code>parent</code>.
- *
- * @param parent a node in the tree, obtained from this data source
- * @return the number of children of the node <code>parent</code>
- * @todo Diese javax.swing.tree.TreeModel-Methode implementieren
- */
- public int getChildCount(Object parent) {
- DefaultMutableTreeNode node = (DefaultMutableTreeNode) parent;
- return node.getChildCount();
- }
-
- /**
- * Returns <code>true</code> if <code>node</code> is a leaf.
- *
- * @param node a node in the tree, obtained from this data source
- * @return true if <code>node</code> is a leaf
- * @todo Diese javax.swing.tree.TreeModel-Methode implementieren
- */
- public boolean isLeaf(Object node) {
- DefaultMutableTreeNode leaf = (DefaultMutableTreeNode) node;
- return leaf.isLeaf();
- }
-
- /**
- * Messaged when the user has altered the value for the item identified by
- * <code>path</code> to <code>newValue</code>.
- *
- * @param path path to the node that the user has altered
- * @param newValue the new value from the TreeCellEditor
- * @todo Diese javax.swing.tree.TreeModel-Methode implementieren
- */
- public void valueForPathChanged(TreePath path, Object newValue) {
- throw new RuntimeException("Manipulation of objecttree not yet supported!");
- }
-
- /**
- * Returns the index of child in parent.
- *
- * @param parent a note in the tree, obtained from this data source
- * @param child the node we are interested in
- * @return the index of the child in the parent, or -1 if either
- * <code>child</code> or <code>parent</code> are <code>null</code>
- * @todo Diese javax.swing.tree.TreeModel-Methode implementieren
- */
- public int getIndexOfChild(Object parent, Object child) {
- DefaultMutableTreeNode parentobj = (DefaultMutableTreeNode) parent;
- DefaultMutableTreeNode childobj = (DefaultMutableTreeNode) child;
- return parentobj.getIndex(childobj);
- }
-
- public synchronized void removeTreeModelListener(TreeModelListener l) {
- if (treeModelListeners != null && treeModelListeners.contains(l)) {
- Vector v = (Vector) treeModelListeners.clone();
- v.removeElement(l);
- treeModelListeners = v;
- }
- }
-
- public synchronized void addTreeModelListener(TreeModelListener l) {
- Vector v = treeModelListeners == null ? new Vector(2) :
- (Vector) treeModelListeners.clone();
- if (!v.contains(l)) {
- v.addElement(l);
- treeModelListeners = v;
- }
- }
-
- protected void fireTreeNodesChanged(TreeModelEvent e) {
- if (treeModelListeners != null) {
- Vector listeners = treeModelListeners;
- int count = listeners.size();
- for (int i = 0; i < count; i++) {
- ( (TreeModelListener) listeners.elementAt(i)).treeNodesChanged(e);
- }
- }
- }
-
- protected void fireTreeNodesInserted(TreeModelEvent e) {
- if (treeModelListeners != null) {
- Vector listeners = treeModelListeners;
- int count = listeners.size();
- for (int i = 0; i < count; i++) {
- ( (TreeModelListener) listeners.elementAt(i)).treeNodesInserted(e);
- }
- }
- }
-
- protected void fireTreeNodesRemoved(TreeModelEvent e) {
- if (treeModelListeners != null) {
- Vector listeners = treeModelListeners;
- int count = listeners.size();
- for (int i = 0; i < count; i++) {
- ( (TreeModelListener) listeners.elementAt(i)).treeNodesRemoved(e);
- }
- }
- }
-
- protected void fireTreeStructureChanged(TreeModelEvent e) {
- if (treeModelListeners != null) {
- Vector listeners = treeModelListeners;
- int count = listeners.size();
- for (int i = 0; i < count; i++) {
- ( (TreeModelListener) listeners.elementAt(i)).treeStructureChanged(e);
- }
- }
- }
-
- /**
- * When an object implementing interface <code>Runnable</code> is used to
- * create a thread, starting the thread causes the object's <code>run</code>
- * method to be called in that separately executing thread.
- *
- * @todo Diese java.lang.Runnable-Methode implementieren
- */
- public void run() {
- try {
- PdfDictionary catalog = reader.getCatalog();
- PdfDictionary rootPages = (PdfDictionary) PdfReader.getPdfObject(
- catalog.get(PdfName.PAGES));
- DefaultMutableTreeNode rootPagesGUI = new SimpletextTreeNode("Pagetree " +
- rootPages);
- filenode.add(rootPagesGUI);
- iteratePages(rootPages, reader, rootPagesGUI);
-
- PdfDictionary rootOutlines = (PdfDictionary) PdfReader.getPdfObject(
- catalog.get(PdfName.OUTLINES));
- if (rootOutlines != null) {
- DefaultMutableTreeNode outlinetree = new SimpletextTreeNode(
- "Outlinetree " + rootOutlines);
- filenode.add(outlinetree);
- PdfObject firstindref = rootOutlines.get(PdfName.FIRST);
- if (firstindref != null) {
- PdfDictionary first = (PdfDictionary) PdfReader.getPdfObject( (
- PRIndirectReference) firstindref);
- if (first != null) {
- iterateOutlines(first, reader, outlinetree);
- }
- }
- }
- System.out.println(" Pagecount= " + pagecount);
- progressdialog.setVisible(false);
- }
- catch (Exception e) {
- e.printStackTrace(System.out);
- }
- }
-
- public int getPagecount() {
- return pagecount;
- }
-
- public void updatecount() {
- progressdialog.setAktuelleseite(getPagecount());
- }
-}
diff --git a/src/main/java/com/lowagie/tools/plugins/treeview/ArrayTreeNode.java b/src/main/java/com/lowagie/tools/plugins/treeview/ArrayTreeNode.java
deleted file mode 100644
index 07ec49c..0000000
--- a/src/main/java/com/lowagie/tools/plugins/treeview/ArrayTreeNode.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * $Id: ArrayTreeNode.java,v 1.2 2006/05/30 09:13:36 blowagie Exp $
- * $Name: $
- *
- * Copyright 2005 by Anonymous.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (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.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.tools.plugins.treeview;
-
-import com.lowagie.text.pdf.PdfArray;
-import java.util.ArrayList;
-import javax.swing.Icon;
-import javax.swing.ImageIcon;
-
-/**
- * <p>Title: </p>
- *
- * <p>Description: </p>
- *
- * <p>Copyright: Copyright (c) 2005</p>
- *
- * <p>Company: </p>
- *
- * @author not attributable
- * @version 1.0
- */
-public class ArrayTreeNode
- extends UpdateableTreeNode {
- PdfArray arr;
-
- public ArrayTreeNode(Object userObject,PdfArray arr) {
- super(userObject);
- this.arr=arr;
- }
-
- public ArrayTreeNode(Object userObject, boolean allowchildren) {
- super(userObject, allowchildren);
- }
-
- /**
- * updateview
- *
- * @param updateobject IUpdatenodeview
- * @todo Implement this com.lowagie.tools.plugins.treeview.UpdateableTreeNode method
- */
- public void updateview(IUpdatenodeview updateobject) {
- StringBuffer sb = new StringBuffer();
- sb.append("<html>");
- sb.append("<p>");
- sb.append(this.userObject);
- sb.append("</p>");
- ArrayList arl = arr.getArrayList();
- for (int i = 0; i < arl.size(); i++) {
- sb.append("<p>");
- sb.append(" " + arl.get(i).toString());
- sb.append("</p>");
- }
- sb.append("</html>");
- updateobject.showvalues(sb.toString());
- }
- public Icon getIcon(){
- return new ImageIcon(TreeViewInternalFrame.class.getResource(
- "array.gif"));
- }
-}
diff --git a/src/main/java/com/lowagie/tools/plugins/treeview/DictionaryTreeNode.java b/src/main/java/com/lowagie/tools/plugins/treeview/DictionaryTreeNode.java
deleted file mode 100644
index 2fc6b4e..0000000
--- a/src/main/java/com/lowagie/tools/plugins/treeview/DictionaryTreeNode.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * $Id: DictionaryTreeNode.java,v 1.2 2006/05/30 09:13:36 blowagie Exp $
- * $Name: $
- *
- * Copyright 2005 by Anonymous.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (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.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.tools.plugins.treeview;
-
-import java.util.Set;
-import java.util.Iterator;
-import com.lowagie.text.pdf.PdfDictionary;
-import javax.swing.Icon;
-import javax.swing.ImageIcon;
-
-/**
- * <p>Title: </p>
- *
- * <p>Description: </p>
- *
- * <p>Copyright: Copyright (c) 2005</p>
- *
- * <p>Company: </p>
- *
- * @author not attributable
- * @version 1.0
- */
-public class DictionaryTreeNode
- extends UpdateableTreeNode {
- PdfDictionary dictionary;
-
- public DictionaryTreeNode(Object userObject, PdfDictionary dictionary) {
- super(userObject);
- this.dictionary = dictionary;
- }
-
- public DictionaryTreeNode(Object userObject, boolean allowchildren) {
- super(userObject, allowchildren);
- }
-
- /**
- * updateview
- *
- * @param updateobject IUpdatenodeview
- * @todo Implement this com.lowagie.tools.plugins.treeview.UpdateableTreeNode method
- */
- public void updateview(IUpdatenodeview updateobject) {
- StringBuffer sb = new StringBuffer();
- sb.append("<html>");
- sb.append("<p>");
- sb.append(this.userObject);
- sb.append("</p>");
- Set set = dictionary.getKeys();
- Iterator it = set.iterator();
- while (it.hasNext()) {
- sb.append("<p>");
- sb.append("Key " + it.next().toString());
- sb.append("</p>");
- }
- sb.append("</html>");
- updateobject.showvalues(sb.toString());
- }
-
- public Icon getIcon(){
- return new ImageIcon(TreeViewInternalFrame.class.getResource(
- "dictionary.gif"));
- }
-
-}
diff --git a/src/main/java/com/lowagie/tools/plugins/treeview/FileTreeNode.java b/src/main/java/com/lowagie/tools/plugins/treeview/FileTreeNode.java
deleted file mode 100644
index 85e83a6..0000000
--- a/src/main/java/com/lowagie/tools/plugins/treeview/FileTreeNode.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * $Id: FileTreeNode.java,v 1.3 2006/05/30 09:13:36 blowagie Exp $
- * $Name: $
- *
- * Copyright 2005 by Anonymous.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (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.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.tools.plugins.treeview;
-
-import com.lowagie.text.pdf.*;
-import javax.swing.Icon;
-import javax.swing.ImageIcon;
-
-public class FileTreeNode
- extends UpdateableTreeNode {
-
- PdfReader reader;
- public FileTreeNode(Object p0, PdfReader reader) {
- super(p0,true);
- this.reader = reader;
- }
-
- public void updateview(IUpdatenodeview updateobject) {
- StringBuffer sb = new StringBuffer();
- sb.append("<html>");
- sb.append("<p>");
- sb.append(this.userObject);
- sb.append("</p>");
- sb.append("<p>");
- sb.append("PDF Version 1." + this.reader.getPdfVersion());
- sb.append("</p>");
- sb.append("<p>");
- sb.append("Number of Pages: " + this.reader.getNumberOfPages());
- sb.append("</p>");
- sb.append("</html>");
- updateobject.showvalues(sb.toString());
- }
- public Icon getIcon(){
- return new ImageIcon(TreeViewInternalFrame.class.getResource(
- "icon16.gif"));
- }
-
-}
diff --git a/src/main/java/com/lowagie/tools/plugins/treeview/ICommonAnalyzer.java b/src/main/java/com/lowagie/tools/plugins/treeview/ICommonAnalyzer.java
deleted file mode 100644
index 17093f0..0000000
--- a/src/main/java/com/lowagie/tools/plugins/treeview/ICommonAnalyzer.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * $Id: ICommonAnalyzer.java,v 1.2 2005/12/06 13:20:39 blowagie Exp $
- * $Name: $
- *
- * Copyright 2005 by Anonymous.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (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.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.tools.plugins.treeview;
-
-import javax.swing.tree.DefaultMutableTreeNode;
-
-import com.lowagie.text.pdf.PdfObject;
-import com.lowagie.text.pdf.PdfReader;
-/**
- *
- * <p>Title: </p>
- *
- * <p>Description: </p>
- *
- * <p>Copyright: Copyright (c) 2005</p>
- *
- * <p>Company: </p>
- *
- * @author not attributable
- * @version 1.0
- */
-public interface ICommonAnalyzer {
- /**
- *
- * @param pdfobj PdfObject
- * @param pdfreader PdfReader
- * @param node DefaultMutableTreeNode
- */
- void iterateObjects(PdfObject pdfobj, PdfReader pdfreader,
- DefaultMutableTreeNode node);
-}
diff --git a/src/main/java/com/lowagie/tools/plugins/treeview/IUpdatenodeview.java b/src/main/java/com/lowagie/tools/plugins/treeview/IUpdatenodeview.java
deleted file mode 100644
index 01a3b45..0000000
--- a/src/main/java/com/lowagie/tools/plugins/treeview/IUpdatenodeview.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * $Id: IUpdatenodeview.java,v 1.1 2005/11/29 21:05:02 blowagie Exp $
- * $Name: $
- *
- * Copyright 2005 by Anonymous.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (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.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.tools.plugins.treeview;
-
-public interface IUpdatenodeview {
- public void showempty();
-
- public void showtext(String text);
-
- public void showvalues(String text);
-}
diff --git a/src/main/java/com/lowagie/tools/plugins/treeview/OutlinelistTreeNode.java b/src/main/java/com/lowagie/tools/plugins/treeview/OutlinelistTreeNode.java
deleted file mode 100644
index 2fd78e5..0000000
--- a/src/main/java/com/lowagie/tools/plugins/treeview/OutlinelistTreeNode.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * $Id: OutlinelistTreeNode.java,v 1.2 2006/05/30 09:13:36 blowagie Exp $
- * $Name: $
- *
- * Copyright 2005 by Anonymous.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (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.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.tools.plugins.treeview;
-
-import java.util.ArrayList;
-
-import com.lowagie.text.pdf.PdfArray;
-import com.lowagie.text.pdf.PdfDictionary;
-import java.util.Set;
-import java.util.Iterator;
-import javax.swing.Icon;
-import javax.swing.ImageIcon;
-
-public class OutlinelistTreeNode
- extends UpdateableTreeNode {
- private com.lowagie.text.pdf.PdfDictionary dictionary;
- public OutlinelistTreeNode(Object userObject, PdfDictionary dictionary) {
- super(userObject);
- this.dictionary = dictionary;
- }
-
- public OutlinelistTreeNode(PdfDictionary dictionary) {
- super("Outlinenode " + dictionary);
- this.dictionary = dictionary;
- }
-
- public void updateview(IUpdatenodeview updateobject) {
- StringBuffer sb = new StringBuffer();
- sb.append("<html>");
- sb.append("<p>");
- sb.append(this.userObject);
- sb.append("</p>");
- Set set = dictionary.getKeys();
- Iterator it = set.iterator();
- while (it.hasNext()) {
- sb.append("<p>");
- sb.append("Key " + it.next().toString());
- sb.append("</p>");
- }
- sb.append("</html>");
- updateobject.showvalues(sb.toString());
-
- }
-
- public Icon getIcon(){
- return new ImageIcon(TreeViewInternalFrame.class.getResource(
- "bookmarks.gif"));
- }
-
-}
diff --git a/src/main/java/com/lowagie/tools/plugins/treeview/PagelistTreeNode.java b/src/main/java/com/lowagie/tools/plugins/treeview/PagelistTreeNode.java
deleted file mode 100644
index 928fefa..0000000
--- a/src/main/java/com/lowagie/tools/plugins/treeview/PagelistTreeNode.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * $Id: PagelistTreeNode.java,v 1.2 2006/05/30 09:13:36 blowagie Exp $
- * $Name: $
- *
- * Copyright 2005 by Anonymous.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (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.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.tools.plugins.treeview;
-
-import java.util.ArrayList;
-
-import com.lowagie.text.pdf.PdfArray;
-import javax.swing.Icon;
-import javax.swing.ImageIcon;
-
-public class PagelistTreeNode
- extends UpdateableTreeNode {
- private com.lowagie.text.pdf.PdfArray pdfarray;
- public PagelistTreeNode(PdfArray pdfarray) {
- super("Pagesnode " + pdfarray);
- this.pdfarray = pdfarray;
- }
-
- public void updateview(IUpdatenodeview updateobject) {
- StringBuffer sb = new StringBuffer();
- sb.append("<html>");
- sb.append("<p>");
- sb.append(this.userObject);
- sb.append("</p>");
- ArrayList arl = pdfarray.getArrayList();
- for (int i = 0; i < arl.size(); i++) {
- sb.append("<p>");
- sb.append(" " + arl.get(i).toString());
- sb.append("</p>");
- }
- sb.append("</html>");
- updateobject.showvalues(sb.toString());
- }
-
- public Icon getIcon(){
- return new ImageIcon(TreeViewInternalFrame.class.getResource(
- "pageonly.gif"));
- }
-}
diff --git a/src/main/java/com/lowagie/tools/plugins/treeview/Pagetreenode.java b/src/main/java/com/lowagie/tools/plugins/treeview/Pagetreenode.java
deleted file mode 100644
index 4cbcfda..0000000
--- a/src/main/java/com/lowagie/tools/plugins/treeview/Pagetreenode.java
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- * $Id: Pagetreenode.java,v 1.3 2006/05/30 09:13:36 blowagie Exp $
- * $Name: $
- *
- * Copyright 2005 by Anonymous.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (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.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.tools.plugins.treeview;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.Set;
-
-import javax.swing.tree.DefaultMutableTreeNode;
-
-import com.lowagie.text.Rectangle;
-import com.lowagie.text.pdf.*;
-import javax.swing.Icon;
-import javax.swing.ImageIcon;
-
-public class Pagetreenode
- extends UpdateableTreeNode {
- private com.lowagie.text.pdf.PdfDictionary dictionary;
-
- private int seitennummer;
- private float width;
- private float height;
-
- public Pagetreenode(com.lowagie.text.pdf.PdfDictionary page, int seitennummer,
- ICommonAnalyzer pageanalyzer, PdfReader pdfreader) {
- super();
- this.dictionary = page;
- this.seitennummer = seitennummer;
- DefaultMutableTreeNode info;
-
- PdfArray arr = (PdfArray) page.get(PdfName.MEDIABOX);
- float curwidth = 0;
- float curheight = 0;
- if (arr != null) {
- ArrayList arl = arr.getArrayList();
- curwidth = Float.parseFloat(arl.get(2).toString());
- curheight = Float.parseFloat(arl.get(3).toString());
- info = new SimpletextTreeNode(PdfName.MEDIABOX + " " + curwidth + "*" +
- curheight);
- this.add(info);
-
- }
- PdfArray arrcrop = (PdfArray) page.get(PdfName.CROPBOX);
- float curwidthcrop = 0;
- float curheightcrop = 0;
- if (arrcrop != null) {
- ArrayList arl = arrcrop.getArrayList();
- curwidthcrop = Float.parseFloat(arl.get(2).toString());
- curheightcrop = Float.parseFloat(arl.get(3).toString());
- info = new SimpletextTreeNode(PdfName.CROPBOX + " " + curwidthcrop + "*" +
- curheightcrop);
- this.add(info);
-
- }
-
- PdfNumber rotation = (PdfNumber) PdfReader.getPdfObject(page.get(PdfName.
- ROTATE));
-
- if (rotation == null) {
- System.out.println("Rotation missing");
- rotation = new PdfNumber(0);
- }
- else {
- info = new SimpletextTreeNode(PdfName.
- ROTATE + " " + rotation);
- this.add(info);
- }
- Rectangle rect = new Rectangle(curwidthcrop,
- curheightcrop);
-
- if ( (rotation.floatValue() == 90) || (rotation.floatValue() == 270)) {
- rect = rect.rotate();
- }
-
- width = rect.width();
- height = rect.height();
-
- // ??? Dont want a backreference! PdfDictionary parent = (PdfDictionary) PdfReader.getPdfObject(page.get(PdfName.PARENT));
- PdfArray dict = (PdfArray) PdfReader.getPdfObject(page.get(PdfName.ANNOTS));
- if (dict != null) {
- this.add(new SimpletextTreeNode(PdfName.ANNOTS + " " + dict.length()));
- SimpletextTreeNode sttn = new SimpletextTreeNode(PdfName.ANNOTS + " " +
- dict.type());
- this.add(sttn);
- pageanalyzer.iterateObjects(dict, pdfreader, sttn);
-
- }
- PdfObject reso = PdfReader.getPdfObject(page.get(PdfName.RESOURCES));
- if (reso != null) {
- SimpletextTreeNode sttn = new SimpletextTreeNode(PdfName.RESOURCES + " " +
- reso.type());
- this.add(sttn);
- pageanalyzer.iterateObjects(reso, pdfreader, sttn);
- }
-
- PdfObject contents = PdfReader.getPdfObject(page.get(PdfName.CONTENTS));
- if (contents != null) {
- this.add(new TextpaneTreeNode(contents,"Content"));
-
- if (contents.isStream()) {
- PRStream prstr = (PRStream) contents;
-
- Set s = prstr.getKeys();
- Iterator it = s.iterator();
-
- while (it.hasNext()) {
- Object obj = it.next();
- System.out.println("Field:" + obj);
-
- Object value = PdfReader.getPdfObject(prstr.get( (PdfName) obj));
- System.out.println("Value:" + value);
- }
- }
- }
- }
-
- public int getSeitennummer() {
- return seitennummer;
- }
-
- public String toString() {
- return "Page " + seitennummer;
- }
-
- public float getWidth() {
- return width;
- }
-
- public float getHeight() {
- return height;
- }
-
- public void updateview(IUpdatenodeview updateobject) {
- StringBuffer sb = new StringBuffer();
- sb.append("<html>");
- sb.append("<p>");
- sb.append("Page " + getSeitennummer());
- sb.append("</p>");
- sb.append("<p>");
- sb.append("Size: " + getWidth() + "*" + getHeight());
- sb.append("</p>");
-
- Set set = dictionary.getKeys();
- Iterator it = set.iterator();
- while (it.hasNext()) {
- sb.append("<p>");
- sb.append("Key " + it.next().toString());
- sb.append("</p>");
- }
- sb.append("</html>");
- updateobject.showvalues(sb.toString());
- }
-
- public Icon getIcon(){
- return new ImageIcon(TreeViewInternalFrame.class.getResource(
- "pageonly.gif"));
- }
-
-
-}
diff --git a/src/main/java/com/lowagie/tools/plugins/treeview/ProgressDialog.java b/src/main/java/com/lowagie/tools/plugins/treeview/ProgressDialog.java
deleted file mode 100644
index 42e46db..0000000
--- a/src/main/java/com/lowagie/tools/plugins/treeview/ProgressDialog.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * $Id: ProgressDialog.java,v 1.1 2005/11/29 21:05:02 blowagie Exp $
- * $Name: $
- *
- * Copyright 2005 by Anonymous.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (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.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.tools.plugins.treeview;
-
-import java.awt.BorderLayout;
-import java.awt.Dimension;
-import java.awt.Frame;
-import java.awt.Toolkit;
-import javax.swing.JDialog;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JProgressBar;
-
-
-public class ProgressDialog extends JDialog {
- JPanel panel1 = new JPanel();
- BorderLayout borderLayout1 = new BorderLayout();
- JPanel jPanel1 = new JPanel();
- BorderLayout borderLayout2 = new BorderLayout();
- BorderLayout borderLayout3 = new BorderLayout();
- JLabel jLabel1 = new JLabel();
- JProgressBar jProgressBar1 = new JProgressBar();
- private int anzahlseiten;
- private int aktuelleseite;
-
- public ProgressDialog(Frame frame, String title, boolean modal) {
- super(frame, title, modal);
- try {
- jbInit();
- pack();
- }
- catch(Exception ex) {
- ex.printStackTrace();
- }
- }
-
- public ProgressDialog() {
- this(null, "", false);
- }
-
- private void jbInit() throws Exception {
- panel1.setLayout(borderLayout1);
- this.getContentPane().setLayout(borderLayout2);
- jPanel1.setLayout(borderLayout3);
- jLabel1.setText("Analysefortschritt");
- jProgressBar1.setStringPainted(true);
- getContentPane().add(panel1, BorderLayout.CENTER);
- panel1.add(jPanel1, BorderLayout.CENTER);
- jPanel1.add(jProgressBar1, BorderLayout.CENTER);
- this.getContentPane().add(jLabel1, BorderLayout.NORTH);
- //Das Fenster zentrieren
- Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
- Dimension frameSize = getSize();
- if (frameSize.height > screenSize.height) {
- frameSize.height = screenSize.height;
- }
- if (frameSize.width > screenSize.width) {
- frameSize.width = screenSize.width;
- }
- setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2);
- }
- public int getAnzahlseiten() {
- return anzahlseiten;
- }
- public void setAnzahlseiten(int anzahlseiten) {
- this.anzahlseiten = anzahlseiten;
- jProgressBar1.setMaximum(anzahlseiten);
- }
- public int getAktuelleseite() {
- return aktuelleseite;
- }
- public void setAktuelleseite(int aktuelleseite) {
- this.aktuelleseite = aktuelleseite;
- jProgressBar1.setValue(aktuelleseite);
- }
-}
diff --git a/src/main/java/com/lowagie/tools/plugins/treeview/SimpletextTreeNode.java b/src/main/java/com/lowagie/tools/plugins/treeview/SimpletextTreeNode.java
deleted file mode 100644
index 2eedb6e..0000000
--- a/src/main/java/com/lowagie/tools/plugins/treeview/SimpletextTreeNode.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * $Id: SimpletextTreeNode.java,v 1.1 2005/11/29 21:05:02 blowagie Exp $
- * $Name: $
- *
- * Copyright 2005 by Anonymous.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (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.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.tools.plugins.treeview;
-
-public class SimpletextTreeNode
- extends UpdateableTreeNode {
-
- public SimpletextTreeNode(Object p0) {
- super(p0);
- }
-
- public void updateview(IUpdatenodeview updateobject) {
- StringBuffer sb = new StringBuffer();
- sb.append("<html>");
- sb.append("<p>");
- sb.append(this.userObject);
- sb.append("</p>");
- sb.append("</html>");
- updateobject.showvalues(sb.toString());
- }
-}
diff --git a/src/main/java/com/lowagie/tools/plugins/treeview/TextpaneTreeNode.java b/src/main/java/com/lowagie/tools/plugins/treeview/TextpaneTreeNode.java
deleted file mode 100644
index bf37c7a..0000000
--- a/src/main/java/com/lowagie/tools/plugins/treeview/TextpaneTreeNode.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * $Id: TextpaneTreeNode.java,v 1.2 2006/05/30 09:13:36 blowagie Exp $
- * $Name: $
- *
- * Copyright 2005 by Anonymous.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (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.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.tools.plugins.treeview;
-
-import java.io.IOException;
-
-import com.lowagie.text.pdf.*;
-import javax.swing.Icon;
-import javax.swing.ImageIcon;
-
-public class TextpaneTreeNode
- extends UpdateableTreeNode {
- PdfObject contents;
- String marker;
-
- public TextpaneTreeNode(PdfObject contents,String marker) {
- super(contents,false);
- this.contents = contents;
- this.marker=marker;
- }
-
- public void updateview(IUpdatenodeview updateobject) {
- if (contents.isStream()) {
- PRStream prstr = (PRStream) contents;
- try {
- byte barr[] = PdfReader.getStreamBytes(prstr);
- updateobject.showtext(new String(barr));
- }
- catch (IOException ex) {
- }
- }
- }
-
- public String toString() {
- return marker;
- }
-
- public Icon getIcon(){
- return new ImageIcon(TreeViewInternalFrame.class.getResource(
- "string.gif"));
- }
-
-}
diff --git a/src/main/java/com/lowagie/tools/plugins/treeview/TreeViewInternalFrame.java b/src/main/java/com/lowagie/tools/plugins/treeview/TreeViewInternalFrame.java
deleted file mode 100644
index 802059b..0000000
--- a/src/main/java/com/lowagie/tools/plugins/treeview/TreeViewInternalFrame.java
+++ /dev/null
@@ -1,272 +0,0 @@
-/*
- * $Id: TreeViewInternalFrame.java,v 1.4 2006/05/29 10:31:32 blowagie Exp $
- * $Name: $
- *
- * Copyright 2005 by Anonymous.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (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.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.tools.plugins.treeview;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-
-import java.awt.BorderLayout;
-import java.awt.CardLayout;
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import javax.swing.*;
-import javax.swing.event.TreeSelectionEvent;
-import javax.swing.event.TreeSelectionListener;
-import javax.swing.tree.TreeModel;
-import javax.swing.tree.DefaultTreeModel;
-import javax.swing.tree.DefaultMutableTreeNode;
-import com.lowagie.tools.SwingWorker;
-import java.awt.Cursor;
-import javax.swing.tree.DefaultTreeCellRenderer;
-import java.awt.Component;
-import javax.swing.table.TableColumnModel;
-
-public class TreeViewInternalFrame
- extends JInternalFrame implements PropertyChangeListener, IUpdatenodeview {
- AnalyzePDF analyzer;
-
- public TreeViewInternalFrame(String title, boolean resizable,
- boolean closable,
- boolean maximizable) {
- super(title, resizable, closable, maximizable);
- try {
- jbInit();
- }
- catch (Exception ex) {
- ex.printStackTrace();
- }
- }
-
- private void jbInit() throws Exception {
- this.getContentPane().setLayout(borderLayout1);
- jPanel1.setLayout(borderLayout2);
- jPanel2.setLayout(cardLayout2);
- jSplitPane1.setMinimumSize(new Dimension(150, 100));
- jSplitPane1.setOrientation(JSplitPane.VERTICAL_SPLIT);
- jTree1.addTreeSelectionListener(new Untitled1_jTree1_treeSelectionAdapter(this));
- jPanel4.setLayout(borderLayout3);
- jPanel5.setLayout(borderLayout5);
- jTree1.setModel(defaultree);
- jPanel3.setLayout(borderLayout6);
- jPanel6.setLayout(borderLayout7);
- jSplitPane2.setDividerSize(3);
- jPanel1.add(jSplitPane1, java.awt.BorderLayout.CENTER);
- this.getContentPane().add(jSplitPane1, java.awt.BorderLayout.CENTER);
- jPanel2.add(jPanel4, "empty");
- jPanel2.add(jPanel5, "values");
- jScrollPane3.setViewportView(jLabel1);
- jScrollPane2.setViewportView(jTextPane1);
- jPanel2.add(jScrollPane2, "text");
- jSplitPane1.add(jPanel3, JSplitPane.TOP);
- jPanel5.add(jScrollPane3, java.awt.BorderLayout.CENTER);
- jSplitPane1.add(jPanel2, JSplitPane.BOTTOM);
- jSplitPane2.add(jScrollPane1, JSplitPane.TOP);
- jSplitPane2.add(jPanel6, JSplitPane.BOTTOM);
- jScrollPane4.setViewportView(jTable1);
- jPanel3.add(jSplitPane2, java.awt.BorderLayout.CENTER);
- jPanel6.add(jScrollPane4, java.awt.BorderLayout.CENTER);
- jScrollPane1.setViewportView(jTree1);
- jSplitPane1.setDividerLocation(170);
- jSplitPane2.setDividerLocation(200);
- PDFTreeCellRenderer renderer=new PDFTreeCellRenderer();
- jTree1.setCellRenderer(renderer);
- }
-
- public void setTreemodel(TreeModel treemodel) {
- jTree1.setModel(treemodel);
- }
-
- JPanel jPanel1 = new JPanel();
- BorderLayout borderLayout1 = new BorderLayout();
- JSplitPane jSplitPane1 = new JSplitPane();
- JScrollPane jScrollPane1 = new JScrollPane();
- JTree jTree1 = new JTree();
- JPanel jPanel2 = new JPanel();
- BorderLayout borderLayout2 = new BorderLayout();
- BorderLayout borderLayout4 = new BorderLayout();
- CardLayout cardLayout2 = new CardLayout();
- JPanel jPanel4 = new JPanel();
- JTextPane jTextPane1 = new JTextPane();
- JPanel jPanel5 = new JPanel();
- BorderLayout borderLayout3 = new BorderLayout();
- BorderLayout borderLayout5 = new BorderLayout();
- JLabel jLabel1 = new JLabel();
- JScrollPane jScrollPane2 = new JScrollPane();
- JScrollPane jScrollPane3 = new JScrollPane();
- DefaultTreeModel defaultree = new DefaultTreeModel(new DefaultMutableTreeNode());
- JPanel jPanel3 = new JPanel();
- BorderLayout borderLayout6 = new BorderLayout();
- JPanel jPanel6 = new JPanel();
- JTable jTable1 = new JTable();
- BorderLayout borderLayout7 = new BorderLayout();
- JSplitPane jSplitPane2 = new JSplitPane();
- JScrollPane jScrollPane4 = new JScrollPane();
- TableColumnModel tableColumnModel1 = jTable1.getColumnModel();
- /**
- * This method gets called when a bound property is changed.
- *
- * @param evt A PropertyChangeEvent object describing the event source and the property that has
- * changed.
- * @todo Implement this java.beans.PropertyChangeListener method
- */
- public void propertyChange(PropertyChangeEvent evt) {
-
- String propertyname = evt.getPropertyName();
-
- if (propertyname == null) {
- return;
- }
- else if (propertyname.equals("srcfile")) {
- final String filename = (String) evt.getNewValue();
- final ProgressDialog blubb;
- blubb = new ProgressDialog(null, "PDF Analysefortschritt", false);
-
- final JInternalFrame jif = this;
- SwingWorker work = new SwingWorker() {
-
- public Object construct() {
- AnalyzePDF analyzer = new AnalyzePDF(filename, blubb);
- jif.setCursor(Cursor.getDefaultCursor());
- return analyzer;
- }
- };
- jif.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
- work.start();
- blubb.show();
- analyzer = (AnalyzePDF) work.get();
-
- Timer activitymonitor = new Timer(250, new ActionListener() {
- public void actionPerformed(ActionEvent event) {
- analyzer.updatecount();
- }
- });
-
- analyzer.start();
- activitymonitor.start();
- setTreemodel(analyzer);
- this.jTable1.setModel(analyzer.getXReftable());
- }
- }
-
- public void jTree1_valueChanged(TreeSelectionEvent e) {
- String event = e.getClass().toString();
- if (event.equalsIgnoreCase("class javax.swing.event.TreeSelectionEvent")) {
- UpdateableTreeNode selectednode = (UpdateableTreeNode) jTree1.
- getLastSelectedPathComponent();
- System.out.println("Selected node: " + selectednode);
- if (selectednode != null) {
- selectednode.updateview(this);
- }
- }
- }
-
- /**
- * This method fills the bottom window with the given text in a JtextPane
- * IUpdatenodeview method
- * @param text String Plain text
- */
- public void showtext(String text) {
- jTextPane1.setText(text);
- cardLayout2.show(jPanel2, "text");
- jPanel2.repaint();
- jTextPane1.repaint();
- }
-
- /**
- * This method clears the bottom window
- * IUpdatenodeview method
- */
- public void showempty() {
- cardLayout2.show(jPanel2, "empty");
- jPanel2.repaint();
- }
-
- /**
- * This method fills the bottom window with the given text in a JLabel
- * IUpdatenodeview method
- * @param text String HTML formatted text
- */
- public void showvalues(String text) {
- jLabel1.setText(text);
- cardLayout2.show(jPanel2, "values");
- }
-
- class PDFTreeCellRenderer extends DefaultTreeCellRenderer{
- public Component getTreeCellRendererComponent(JTree tree,Object value,boolean selected,boolean expanded,boolean leaf,int row,boolean hasFocus){
- super.getTreeCellRendererComponent(tree,value,selected,expanded,leaf,row,hasFocus);
- DefaultMutableTreeNode node=(DefaultMutableTreeNode)value;
- if(node instanceof UpdateableTreeNode){
- UpdateableTreeNode utn=(UpdateableTreeNode)node;
- Object o = node.getUserObject();
- setFont(getFont().deriveFont(12.1f));
-// setIcon(new ImageIcon(TreeViewInternalFrame.class.getResource(
-// "icon16.gif")));
- setIcon(utn.getIcon());
- }
- return this;
- }
- }
-}
-
-class Untitled1_jTree1_treeSelectionAdapter
- implements TreeSelectionListener {
- private TreeViewInternalFrame adaptee;
- Untitled1_jTree1_treeSelectionAdapter(TreeViewInternalFrame adaptee) {
- this.adaptee = adaptee;
- }
-
- public void valueChanged(TreeSelectionEvent e) {
- adaptee.jTree1_valueChanged(e);
- }
-
-
-}
diff --git a/src/main/java/com/lowagie/tools/plugins/treeview/UpdateableTreeNode.java b/src/main/java/com/lowagie/tools/plugins/treeview/UpdateableTreeNode.java
deleted file mode 100644
index bd7cf47..0000000
--- a/src/main/java/com/lowagie/tools/plugins/treeview/UpdateableTreeNode.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * $Id: UpdateableTreeNode.java,v 1.2 2006/05/29 10:31:32 blowagie Exp $
- * $Name: $
- *
- * Copyright 2005 by Anonymous.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (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.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.tools.plugins.treeview;
-
-import javax.swing.tree.DefaultMutableTreeNode;
-import javax.swing.ImageIcon;
-import javax.swing.Icon;
-
-public abstract class UpdateableTreeNode
- extends DefaultMutableTreeNode {
- public UpdateableTreeNode() {
- super();
- }
-
- public UpdateableTreeNode(Object userObject) {
- super(userObject);
- }
- public UpdateableTreeNode(Object userObject,boolean allowchildren) {
- super(userObject,allowchildren);
- }
- public abstract void updateview(IUpdatenodeview updateobject);
- public Icon getIcon(){
- return null;
- }
- }
-