Acrobat PDF: Adding multiple files with bookmark names

Trying to do the following:

  1. Combine multiple pdfs into one pdf.
    – The pdfs are in sequence. 01 - Filename.pdf, 02 - Filename.pdf, 03 - Filename.pdf
  2. As an pdf is added a new bookmark is added to the first page of the document.
    – ideally the bookmark name would be the title of the document
    – secondly it can be the name of the file but the above would be preferred.
  3. An ability to assure that all bookmark properties are identical for instance all are inherited zoom.

I have the ability to use acrobat 7. Any help would be greatly appreciated.

thanks like always

I have been trying almost the very same thing. Unfortunately getting hold of any guide for scripting in any thing other than java has proved fruitless. If I do make any headway I will post back. Acrobat appears to be one of those app’s where using dictonary terms as you would expect, offen does not work as expected. Good luck. I have java to strip files down to single pages but could find none to do the opposite.

I found this:

ARTS PDF Aerialist Professional 1.2
http://www.artspdf.com

Seems to have all and more features however $600+ price tag … is an ouch factor.

Rather have a script to do it since acrobat pdf should have these features but no luck on that fact.

Here’s something I found on a Japanese site: MergePDF (which has an English manual and a lot of the site is translated).

http://homepage.mac.com/tkurita/scriptfactory/index.html

http://homepage.mac.com/tkurita/scriptfactory/en/index.html

I use MergePDF 1.6.1 with Acrobat 6, but there’s a version for 7 – it does exactly what you want.

There was also something here at the forums that did this also, but it wasn’t as slick as MergePDF.

Slashdot, well wouldn’t you just believe it having bashed my head against the desk for a whole day then spending 3 more days doing this manually I’ve just had a bit of a break through. This worked have your first page open in Acrobat then point the script to your folder of single pages. Don’t know how much milage you will get from this.

set inputFolder to choose folder
tell application "Finder"
	set filesList to files in inputFolder
end tell
repeat with aFile in filesList
	set fileIndex to 0
	tell application "Finder"
		set theFile to aFile as alias
	end tell
	tell application "Acrobat 6.0.2 Professional"
		activate
		set docRefA to the name of document 1
		set PageCount to count of pages of document 1
		open theFile without invisible
		set docRefB to the name of document 2
		insert pages document docRefA after PageCount from document docRefB starting with 1 number of pages 1 with insert bookmarks
		close document 2 saving no
	end tell
end repeat
tell application "Acrobat 6.0.2 Professional"
	close document 1 saving yes
end tell

Well I never I think this is working too. Will have to put through some testing to check. Should now add all pages for each doc in list invisibly!!

set inputFolder to choose folder
tell application "Finder"
	set filesList to files in inputFolder
end tell
repeat with aFile in filesList
	set fileIndex to 0
	tell application "Finder"
		set theFile to aFile as alias
	end tell
	tell application "Acrobat 6.0.2 Professional"
		activate
		set docRefA to the name of document 1
		set PageCount to count of pages of document docRefA
		open theFile with invisible
		set docRefB to the name of document 2
		set AddPages to count of pages of document docRefB
		insert pages document docRefA after PageCount from document docRefB starting with 1 number of pages AddPages with insert bookmarks
		close document 2 saving no
	end tell
end repeat
tell application "Acrobat 6.0.2 Professional"
	close document 1 saving yes
end tell

thanks mark for the applescript. Gives me a starting point.

Does anyone know how to create bookmarks through applescript.

  1. Go to page # (NOT NEEDED)
  2. Add bookmark:

	tell document 1
		make new bookmark at end with properties ¬
			{destination page number:{56}, fit type:fit page, name:"56"}
	end tell

Thanks Mark for the code above.

  1. if possible change properties to inherit zoom. Not dire but useful.

   activate
       set docRefA to the name of document 1
       set PageCount to count of pages of document 1
       open theFile without invisible
       set docRefB to the name of document 2
       insert pages document docRefA after PageCount from document docRefB starting with 1 number of pages 1 with insert bookmarks
       close document 2 saving no
   end tell

thanks.

Slashdot, not 100% on what you wanted, this should import pages of docs with there bookmarks if they have any? and create a new bookmark at the first page of each imported doc with the docs file name. You could use TID’s on the PDF name if you wanted to remove the suffix. Hope this helps. Again not had much chance for a great deal of tests but appears to be working.

set inputFolder to choose folder
tell application "Finder"
	set filesList to files in inputFolder
end tell
repeat with aFile in filesList
	set fileIndex to 0
	tell application "Finder"
		set theFile to aFile as alias
	end tell
	tell application "Acrobat 6.0.2 Professional"
		activate
		set docRefA to the name of document 1
		set bounds of document 1 to {42, 112, 1000, 1200} -- This was just so I could veiw my script and the doc working.
		set view mode of document 1 to pages and bookmarks
		set PageCount to count of pages of document docRefA
		open theFile with invisible
		set docRefB to the name of document 2
		-- Use TID's here if you want?
		set AddPages to count of pages of document docRefB
		insert pages document docRefA after PageCount from document docRefB starting with 1 number of pages AddPages with insert bookmarks
		tell document 1
			make new bookmark at end with properties ¬
				{destination page number:{(PageCount + 1)}, fit type:fit page, name:docRefB}
		end tell
		close document 2 saving no
	end tell
end repeat
tell application "Acrobat 6.0.2 Professional"
	create thumbs document 1
	close document 1 saving yes
end tell