Copy link to clipboard
Copied
Hi - this script exports my InDesign files into PDFs with security settings. Unfortunately, it also renames the file during export. Is there a way to tweak this script to retain the original file name?
var currPrefs = app.pdfExportPreferences;
with (currPrefs) {
useSecurity = true;
changeSecurityPassword = "**********";
acrobatCompatibility = AcrobatCompatibility.ACROBAT_5;
viewPDF = true;
pageRange = PageRange.ALL_PAGES;
disallowPrinting = true;
disallowCopying = false;
disallowChanging = true;
}
var doc = app.activeDocument;
doc.exportFile(ExportFormat.PDF_TYPE, File("~/Desktop/name.pdf"), false);
currPrefs.useSecurity = false;
Edited the penultimate line of code to save as the current doc's name, replacing indd with pdf. This assumes that the document has been saved and has a name (ie., not Untitled). Will still save to your desktop.
var currPrefs = app.pdfExportPreferences;
with (currPrefs) {
useSecurity = true;
changeSecurityPassword = "**********";
acrobatCompatibility = AcrobatCompatibility.ACROBAT_5;
viewPDF = true;
pageRange = PageRange.ALL_PAGES;
disallowPrinting = true;
disallowCo
...
Copy link to clipboard
Copied
Edited the penultimate line of code to save as the current doc's name, replacing indd with pdf. This assumes that the document has been saved and has a name (ie., not Untitled). Will still save to your desktop.
var currPrefs = app.pdfExportPreferences;
with (currPrefs) {
useSecurity = true;
changeSecurityPassword = "**********";
acrobatCompatibility = AcrobatCompatibility.ACROBAT_5;
viewPDF = true;
pageRange = PageRange.ALL_PAGES;
disallowPrinting = true;
disallowCopying = false;
disallowChanging = true;
}
var doc = app.activeDocument;
doc.exportFile(ExportFormat.PDF_TYPE, File("~/Desktop/" + doc.name.replace(/indd$/gi,"pdf")), false);
currPrefs.useSecurity = false;
Copy link to clipboard
Copied
Thank you so much! I appreciate you 🙂