You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ju...@apache.org on 2010/05/31 13:10:15 UTC

svn commit: r949716 - in /pdfbox/trunk: app/pom.xml pdfbox/src/main/java/org/apache/pdfbox/PDFBox.java

Author: jukka
Date: Mon May 31 11:10:14 2010
New Revision: 949716

URL: http://svn.apache.org/viewvc?rev=949716&view=rev
Log:
PDFBOX-687: Standalone PDFBox jar

Add a dispatcher class for all our command line utilities

Added:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/PDFBox.java   (with props)
Modified:
    pdfbox/trunk/app/pom.xml

Modified: pdfbox/trunk/app/pom.xml
URL: http://svn.apache.org/viewvc/pdfbox/trunk/app/pom.xml?rev=949716&r1=949715&r2=949716&view=diff
==============================================================================
--- pdfbox/trunk/app/pom.xml (original)
+++ pdfbox/trunk/app/pom.xml Mon May 31 11:10:14 2010
@@ -54,7 +54,7 @@
             <Embed-Transitive>true</Embed-Transitive>
             <Embed-Dependency>*;scope=provided;inline=org/apache/**|Resources/**</Embed-Dependency>
             <Bundle-DocURL>${project.url}</Bundle-DocURL>
-            <Main-Class>org.apache.pdfbox.ExtractText</Main-Class>
+            <Main-Class>org.apache.pdfbox.PDFBox</Main-Class>
           </instructions>
         </configuration>
       </plugin>

Added: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/PDFBox.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/PDFBox.java?rev=949716&view=auto
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/PDFBox.java (added)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/PDFBox.java Mon May 31 11:10:14 2010
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pdfbox;
+
+/**
+ * Simple wrapper around all the command line utilities included in PDFBox.
+ * Used as the main class in the runnable standalone PDFBox jar.
+ *
+ * @see <a href="https://issues.apache.org/jira/browse/PDFBOX-687">PDFBOX-687</a>
+ */
+public class PDFBox {
+
+    public static void main(String[] args) {
+        if (args.length > 0) {
+            String command = args[0];
+            String[] arguments = new String[args.length - 1];
+            System.arraycopy(args, 1, arguments, 0, arguments.length);
+
+            try {
+                if (command.equals("ConvertColorspace")) {
+                    ConvertColorspace.main(arguments);
+                } else if (command.equals("Decrypt")) {
+                    Decrypt.main(arguments);
+                } else if (command.equals("Encrypt")) {
+                    Encrypt.main(arguments);
+                } else if (command.equals("ExtractText")) {
+                    ExtractText.main(arguments);
+                } else if (command.equals("Overlay")) {
+                    Overlay.main(arguments);
+                } else if (command.equals("PrintPDF")) {
+                    PrintPDF.main(arguments);
+                } else if (command.equals("PDFDebugger")) {
+                    PDFDebugger.main(arguments);
+                } else if (command.equals("PDFMerger")) {
+                    PDFMerger.main(arguments);
+                } else if (command.equals("PDFReader")) {
+                    PDFReader.main(arguments);
+                } else if (command.equals("PDFReader")) {
+                    PDFReader.main(arguments);
+                } else if (command.equals("PDFSplit")) {
+                    PDFSplit.main(arguments);
+                } else if (command.equals("PDFToImage")) {
+                    PDFToImage.main(arguments);
+                } else if (command.equals("TextToPDF")) {
+                    TextToPDF.main(arguments);
+                }
+                System.exit(0);
+            } catch (Exception e) {
+                System.err.println(
+                        command + " failed with the following exception:");
+                e.printStackTrace();
+                System.exit(1);
+            }
+        }
+
+        System.err.println(
+            "usage: java pdfbox-app-x.y.z.jar <command> <args..>");
+        System.exit(1);
+    }
+
+}

Propchange: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/PDFBox.java
------------------------------------------------------------------------------
    svn:eol-style = native