Pages

Tuesday, August 31, 2010

Open Source Software - PDFsam

Overview
Description:
PDFsam is a Java based open source program that allows the user to manipulate PDFs in various ways. Some of the basic functions of the program allow for the rotating, splitting, extracting, merging, and splicing of PDFs. The program comes in both command line and GUI format to suite the preference of the user.

URL: http://sourceforge.net/projects/pdfsam/

Stated Objectives:
A simple tool designed to split and merge pdf files. With it’s simple and intuitive interface you can:

  • split your pdf documents (into chapters, single pages, etc.).
  • merge many pdf documents or subsections of them.
  • extract sections of your document into a single pdf document.
  • mix alternate pages taken from two pdf documents in straight or reverse order into a single document.
  • rotate pages of the selected pdf documents.
  • visually reorder pages of a selected pdf document.
  • visually compose a document dragging pages from selected pdf documents.
  • save and load your environment to automatize your recurrent jobs.
  • manage pdfsam settings and set an environment to load at start up.

Visual:
GUI Interface of PDFsam




Prime Directive 1
PDFsam is a bare bones PDF manipulator which allows users to effectively and efficiently modify PDFs; I've come to this conclusion after running PDFsam on a few PDFs of various sizes. It is an open source alternative to expensive paid software such as Adobe Acrobat. Though PDFsam does not have all of the features that Adobe Acrobat does, it still has the core features that allow the user to split, merge, rotate, and splice PDFs. For most people looking for a free alternative to Adobe Acrobat, these basic features should satisfy their needs. Though PDFsam only has a few basic functions, it performs these functions exceptionally.  PDFsam might not have every feature that a paid PDF editing program might have, but due to it being open source it leaves room for any programmer to come along and add more features.

For my job at UHM's Hamilton Library I often find myself having to do some tedious task involving PDFs, and thankfully at my work place they have Adobe Acrobat installed. The only problem with this is that I have to physically be in the library to do work that pertains to PDFs, which is quite a pain as I work remotely the majority of the time. After testing this program with various PDFs I would say it can effectively perform the same basic features of merging and splitting that Adobe Acrobat can. If I had known about this software sooner, I would have definitely used it in the past. One thing I am sure of, is that I will definitely be using PDFsam for future tasks involving PDFs.

Prime Directive 2
An external user should be able to install PDFsam without an issue. For Windows users PDFsam downloads as an executable installer and for Mac users it downloads as a DMG file, both of which are standard for installing programs on their respective systems. 

As for use of the program, there is extensive documentation on how to use the software. For an average computer user the program should be pretty straight forward regarding use, but for others it might require a quick reading of said documentation.

Without reading the documentation I was able to install and use this program without any issues whatsoever. I was able to run the program for the first time and merge a PDF without reading a manual; it was rather intuitive.

Prime Directive 3
An external developer would be able to pick up and develop more plugins for this PDFsam, and even make changes to the core program. The structure of this program is very modular; the entire source is extremely well organized. All of the class files are accurately named such as MainGUI.java, PlugInsLoader.java, and MergeMainGUI.java. Along with well named classes and modularity, the whole project is actually exceptionally documented and has an API as a resource for developers.

After taking a brief look through the source of the project I can understand bits and pieces of code, but to actually pick up and develop for this project I think one would need a solid understanding Java and how to write code to modify and export PDFs. To actually pick up and write code for the PDFsam project one would probably have to study the code and API for quite some time as the code seems fairly complex, at least from an undergrad point of view. 

Monday, August 30, 2010

Fizz Buzz Program

Time to implement: 35 minutes (including documentation)

The last time I programmed in java was for my ICS 311 (Algorithms) class about three semesters ago, so I had to look up the proper way to do that javadocing. Other than that I had minimal issues.

One concern that did come up while I was programming was whether or not to print the output in the main method or in the calcFizzBuzz method. After a bit of debating with myself I figured it would be more efficient to call System.out.println(); once in the main method as opposed to four times in the calcFizzBuzz method. Another option would have been to create a variable to store the String to be printed, then at the end of calcFizzBuzz I could have just printed that variable. I figured this was unnecessary and it was most efficient (in my mind) to do it the way I have displayed below.

Doing this assignment reminded me that writing code isn't as simple as creating a program that produces the right output. Code needs to be well written and well documented, if anyone were to ever look at your undocumented code, they would probably go crazy trying to figure out what you were thinking. Software engineering is usually done in teams, and because of this people need to write clear, concise, and well documented code.

package FizzBuzz;

/**
* Fizz Buzz program for ICS 413
*
* Program loops from 1-100 printing: "Fizz" for multiples 
* of 3, "Buzz" for multiples of 5, "FizzBuzz" for multiples
* of both 3 and 5, or the actual integer if it isn't a multiple
* of 3 or 5.
*
* @class  ICS 413
* @author     Anthony Kinsey
* @date   August 28, 2010
*/
public class FizzBuzz {

/*
  * Main Method
  *
  * Loops from 1-100 and calls calcFizzBuzz method
  * to generate the proper output.
  *
  * @param   args[] - Ignored
  * @return  void
  */
public static void main (String[] args) {

   FizzBuzz fizz = new FizzBuzz(); //create instance of this class
   
   for(int i = 1; i < 101; i++) //loop from 1-100
     System.out.println(fizz.calcFizzBuzz(i)); //print output obtained by calling calcFizzBuzz

} // end method main
   

/*
  * calcFizzBuzz
  * 
  * Determines if the provided integer (num) is a multiple of 3, 5, or 3 and 5
  * and prints the following:
  * 
  * if num is multiple of 3 - output is "Fizz"
  * if num is multiple of 5 - output is "Buzz"
  * if num is multiple of 3 and 5 - output is "FizzBuzz"
  * if num is neither a multiple of 3 or 5 - output is String representation of the integer num
  *
  * @param   int num - the integer to analyze
  * @return  String - returns Fizz, Buzz, FizzBuzz, or String representation of an integer
  */
private String calcFizzBuzz(int num) {
   
   if(num % 15 == 0) return "FizzBuzz"; // multiple of 3 and 5
   else if(num % 5 == 0) return "Buzz"; // multiple of 5
   else if(num % 3 == 0) return "Fizz"; // multiple of 3
   else return String.valueOf(num); // neither a multiple of 3 or 5
   
} // end method calcFizzBuzz

} // end class FizzBuzz