Convert PDF to PDF-A with Adobe Acrobat Pro / AppleScript

Can anyone help with this problem? I need a script, that has the function as that script below, which converts a .doc/.docx-file to PDF (with MS Word) and saves it to the same group.

I want to convert a PDF to PDF-A in the same way with Adobe Acrobat Pro!

that’s it! Thanks a lot! :mrgreen:

property extensionList : {"doc", "docx"}

tell application id "DNtp"
	set theInput to {}
	set theSelection to the selection
	repeat with theRecord in theSelection
		set theFile to (path of theRecord) as POSIX file
		set theDoc to theFile as alias
		tell application "Finder"
			set theFilePath to container of theDoc as text
			set ext to name extension of theDoc
			if ext is in extensionList then
				set theName to name of theDoc
				set theFilename to characters 1 through ((length of theName) - (length of ext) - 1) of theName as string
				set theFilename to theFilename & ".pdf"
				tell application "Microsoft Word"
					set theOldDefaultPath to get default file path file path type documents path
					set default file path file path type documents path path theFilePath
					open theDoc
					set theActiveDoc to the active document
					set theFilePath to (path to desktop folder) as string
					set default file path file path type documents path path theFilePath
					save as theActiveDoc file format format PDF file name theFilename
					close theActiveDoc
					set default file path file path type documents path path theOldDefaultPath
				end tell
				set theConvertedPath to (theFilePath & theFilename as string)
			end if
		end tell
		set theConvertedRecord to import POSIX path of theConvertedPath to (parent 1 of theRecord)
		if exists theConvertedRecord then tell application "Finder" to delete theConvertedPath
	end repeat
end tell

Examining the AppleScript dictionary for Acrobat 15 (DC) I see no commands for making PDF-A from PDF; nor do I see any useful ghits for “AppleScript PDF/A”. There are commercial utilities available that will do this conversion.

Thanks a lot!

But may it be possible to use the automator action (“Save as Adobe PDF”, German: “Als Adobe PDF speichern”) with Devonthink?

That Automator action might work on some versions of Acrobat – it does not work for me on Acrobat DC (v15). You can use Automator to get the PDF using DEVONthink actions (see for example this similar workflow), but after that you’re on your own with Acrobat. Have you discussed using Distiller with (or without) Automator on the Acrobat forum?

Thanks for your suggestion!

Generally automator works! But Adobes automator action uses a save dialog and you have to select a folder for the converted PDF/A. …

Is it possible to change Adobes action to overwrite the original PDF-file?

I don’t think you can change Adobe’s Distiller action, but you could build a workflow, incorporating some of the Finder actions, that deletes the file.

… my new idea is to create a folder action script (in Finder), which imports the created PDF/A from selected folder in the save dialog to the current group.

Is that possible? :frowning:

… yes it’s possible and really easy! :unamused:

i’ve used the standard folder action script and changed “incoming group” to “current group”…

sorry for my stupidity!

nevertheless: greatest thank for your support! this is the best support forum, i’ve experienced!!!

No worries! Some things aren’t so obvious (and even seasoned veterans can miss what’s right in from of them). Cheers! :smiley: