1 import org.faceless.pdf2.*; 2 import java.io.*; 3 import java.util.*; 4 5 public class Concatenate 14 { 15 public static void main(String [] args) throws IOException 16 { 17 if (args.length<2) { 18 System.out.println("Usage: java Concatenate <file1> <file2> ... <filen>"); 19 System.out.println(" Creates file \"Concatenate.pdf\""); 20 System.exit(0); 21 } 22 23 24 PDF pdf = new PDF(new PDFReader(new FileInputStream(args[0]))); 25 26 for (int i=1;i<args.length;i++) 27 { 28 FileInputStream in = new FileInputStream(args[i]); 31 PDF newpdf = new PDF(new PDFReader(in)); 32 in.close(); 33 34 pdf.getPages().addAll(newpdf.getPages()); 42 pdf.getForm().getElements().putAll(newpdf.getForm().getElements()); 43 } 44 45 pdf.render(new FileOutputStream("Concatenate.pdf")); 46 } 47 } 48 | Popular Tags |