0

I have a parent folder with around 30 subfolders which each contain pdfs,.doc,.docx, and .jpg files. I need to combine all files into one large pdf. I want the order in which the files are appended into the 'master pdf' to reflect my current folder and file order (which is alphabetic for the subfolder names and numeric for the files within each subfolder).

I am fairly new to Unix and am a bit stuck on this....I would be most grateful for any advice you may have on how to approach this problem. Thank you.

Elizabeth
  • 6,391
  • 17
  • 62
  • 90

1 Answers1

1

There are three problems here:

  1. Traverse the directory tree to find all documents
  2. Convert each file into PDF
  3. Merge the PDFs

For the first part you could use the find command to get the list of files or script the directory traversal.

For the second part you could use OpenOffice/LibreOffice command line driver to convert .doc and .docx files and ghostscript to convert .jpg files.

For the third part, probably ghostscript again.

Alternatively there are good PDF APIs available for some programming languages, such as iText from Lowagie for Java.

Dima Chubarov
  • 16,199
  • 6
  • 40
  • 76