Results 1 to 2 of 2
- 07-26-2011, 11:35 AM #1
Member
- Join Date
- Jul 2011
- Posts
- 1
- Rep Power
- 0
Merging PDF Files using PDFBox in Sub/Directories
Hi,
I am currently trying to create a program that merges all the files in directories and sub-directories (automatically) and rename them according to the directory/sub0directory they are in. I am trying to acheive this using the PDFBox library.
As of now I have found a script that reads all the files and folders in a directory and sub-directories.
My problem is that I don't know how to acheive the merging of PDFs (i.e. merging the files and renaming them according to the folder name).
I found a tutorial on how to merge files with PDFBox here but I need to apply it to do it automatically for all the files in the directories.
The code that lists all the files and folders is this:
Any help please?Java Code:import java.io.File; public class Main { static int spc_count=-1; static void Process(File aFile) { spc_count++; String spcs = ""; for (int i = 0; i < spc_count; i++) spcs += " "; if(aFile.isFile()) System.out.println(spcs + "[FILE] " + aFile.getName()); else if (aFile.isDirectory()) { System.out.println(spcs + "[DIR] " + aFile.getName()); File[] listOfFiles = aFile.listFiles(); if(listOfFiles!=null) { for (int i = 0; i < listOfFiles.length; i++) Process(listOfFiles[i]); } else { System.out.println(spcs + " [ACCESS DENIED]"); } } spc_count--; } public static void main(String[] args) { String nam = "C:\\Documents and Settings\\student3\\Desktop\\PDFs"; File aFile = new File(nam); Process(aFile); } }
Thanks & Regards,
blivori
- 07-26-2011, 06:06 PM #2
Moderator
- Join Date
- Jul 2010
- Location
- California
- Posts
- 1,608
- Rep Power
- 5
Similar Threads
-
Merging multiple XML files
By MarcoGT in forum XMLReplies: 0Last Post: 07-09-2011, 01:59 PM -
Using Jad to decomplie muiltiple class files in different sub directories
By pavankotharu in forum New To JavaReplies: 1Last Post: 07-07-2011, 09:04 PM -
Searching directories for folders and .txt files
By XDrew574X in forum New To JavaReplies: 1Last Post: 03-29-2011, 09:41 PM -
Save files in directories
By Tota in forum New To JavaReplies: 2Last Post: 09-02-2010, 02:49 PM -
List of files and directories.
By artemff in forum CLDC and MIDPReplies: 6Last Post: 01-02-2010, 04:06 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks