Wednesday, October 10, 2012

PDFBOX Merging Multiple PDF

PDFBox is providing excellent support for merging multiple PDF files into one. You just need to add following jars in your project and use below code to merge multiple pdfs 1. PDFBox.jar 2. apache-common-logging Ref:
     * SyntaxHighlighter
import java.util.UUID;

import org.apache.pdfbox.exceptions.COSVisitorException;
import org.apache.pdfbox.util.PDFMergerUtility;

public class PDFMergeTest {
 public static void main(String args[]) throws COSVisitorException, IOException{
  PDFMergerUtility mergePdf = new PDFMergerUtility();
  String folder="D:\\sample";
  String numberOfFiles[]=getFiles(folder);
  for(int i = 0; i < numberOfFiles.length; i++){
   mergePdf.addSource(folder + File.separator + numberOfFiles[i]);
  mergePdf.setDestinationFileName(folder + File.separator + "final.pdf");

 private static String[] getFiles(String folder) throws IOException
  File _folder = new File(folder);
  String[] filesInFolder;   

   filesInFolder = _folder.list();
   return filesInFolder;
   throw new IOException("Path is not a directory");

Sunday, March 6, 2011

How to Create CD to ISO Image File on Linux

  It is so simple .To create iso image file from linux, you don’t need any software. It can be done by only just one command on terminal


cat /dev/scd0 > /home/haroon/ubuntu.iso


Monday, November 29, 2010