Posted this at Adobe and have received no replies. Perhaps someone here has the answer.
Thanks to the help of a couple of people, I have the majority of my script finished. The script exports an InDesign file and saves it as a pdf file. Before the export command it sets the following pdf export preferences:
tell PDF export preferences
--set compatibility
set acrobat compatibility to acrobat 5
--set general settings
set include bookmarks to false
set include hyperlinks to false
set interactive elements to false
--what about eBook Tags? structure
--set colorspace
set PDF color space to unchanged color space
--set bitmap sampling
set color bitmap sampling to bicubic downsample
set grayscale bitmap sampling to bicubic downsample
set monochrome bitmap sampling to bicubic downsample
--set bitmap sampling dpi
set color bitmap sampling DPI to 300
set grayscale bitmap sampling DPI to 300
set monochrome bitmap sampling DPI to 600
--set image quality
set color bitmap quality to maximum
set grayscale bitmap quality to maximum
--set fonts
set subset fonts below to 0
--set security
set use security to true
set change security password to "SHPS"
set disallow copying to true
set disallow extraction for accessibility to false
end tell
Most of this works like a charms. However, there are two parts not working. At the beginning of the script I set the compatibility to Acrobat 5. I run the script open the exported pdf. I select Document Properties from the File menu and select Description. That window says PDF version 1.4 Acrobat 5. Exactly as it should. However, if I select the Security section it says it is compatible with Acrobat 3, not 5. If I export the PDF manually it says Acrobat 5. Any idea why this is not working?
Second, I can’t seem to get the security settings to take. In the code above, I want to disallow copying, but still allow extraction for accessibility. This is something I can do if I export it manually. However, I can not figure how to do this through the export preferences. No matter what I do, either both are allowed or both are disallowed. In the above script, the result is both disallowed. I also want to set some security settings around changing, but I either get allow changing for everything, or nothing. Below is all the test code I am using:
property theExtension : ".pdf"
on run
buildPreferences()
local myDoc, pdfFile, parseTxt, indFile
tell application "InDesign CS"
set myDoc to active document
set indFile to full name of myDoc as Unicode text
if indFile ends with ".indd" or ".INDD" then
set parseTxt to (offset of "." in indFile) - 1
set pdfFile to (text 1 thru parseTxt of indFile) & theExtension as Unicode text
end if
export myDoc format PDF type to pdfFile
end tell
end run
on buildPreferences() --set export options
tell application "InDesign CS"
tell PDF export preferences
--set compatibility
set acrobat compatibility to acrobat 5
--set general settings
set include bookmarks to false
set include hyperlinks to false
set interactive elements to false
--what about eBook Tags? structure
--set colorspace
set PDF color space to unchanged color space
--set bitmap sampling
set color bitmap sampling to bicubic downsample
set grayscale bitmap sampling to bicubic downsample
set monochrome bitmap sampling to bicubic downsample
--set bitmap sampling dpi
set color bitmap sampling DPI to 300
set grayscale bitmap sampling DPI to 300
set monochrome bitmap sampling DPI to 600
--set image quality
set color bitmap quality to maximum
set grayscale bitmap quality to maximum
--set fonts
set subset fonts below to 0
--set security
set use security to true
set change security password to "SHPS"
set disallow extraction for accessibility to false
set disallow copying to true
end tell
end tell
end buildPreferences