Copy link to clipboard
Copied
Can today's date be automatically added before the file name when export PDF?
For example, my file name: myFile.indd
every time to add the day before the date, such as: 2025-02-05-myFile.pdf
I often change the ID file name directly, a little impatient.
I use a bit too many templates and sometimes I need to modify them temporarily.
Directly with the script export, can not temporarily modify the template.
Can you automatically modify the name when exporting?
Then only call the ID software comes with the interface to export PDF?
var myDocument = app.activeDocument;
var myFileName = myDocument.name.replace(/\.indd$/, ''); // Remove the .indd extension
var myDate = new Date();
var myYear = myDate.getFullYear();
var myMonth = ("0" + (myDate.getMonth() + 1)).slice(-2); // Add leading zero
var myDay = ("0" + myDate.getDate()).slice(-2); // Add leading zero
var myFormattedDate = myYear + "-" + myMonth + "-" + myDay;
var myPDFFile = new File(myDocument.filePath + "/" + myFormattedDate + "-" + myFileName + ".pdf");
// Create a...
Copy link to clipboard
Copied
You mean "when exporting"?
It should be achievieable with adding event listener.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Hi @dublove
var myDocument = app.activeDocument;
var myFileName = myDocument.name.replace(/\.indd$/, ''); // Remove the .indd extension
var myDate = new Date();
var myYear = myDate.getFullYear();
var myMonth = ("0" + (myDate.getMonth() + 1)).slice(-2); // Add leading zero
var myDay = ("0" + myDate.getDate()).slice(-2); // Add leading zero
var myFormattedDate = myYear + "-" + myMonth + "-" + myDay;
var myPDFFile = new File(myDocument.filePath + "/" + myFormattedDate + "-" + myFileName + ".pdf");
var myPDFExportPreset = app.pdfExportPresets.item("[High Quality Print]"); // You can change the preset if needed
myDocument.exportFile(ExportFormat.PDF_TYPE, myPDFFile, false, myPDFExportPreset);
Copy link to clipboard
Copied
I can't seem to set the export option.
Third party scripts should be difficult to implement.
Hoping that Adobe will add official functionality.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Thank you very much
Sorry ,sorry ,It's export PDF, I wrote import by mistake.
I know how to do it, I think I've seen who seems to have written scripts for exporting PDF interfaces.
Might be able to write this current script with that one.
I use a bit too many templates and sometimes I need to modify them temporarily.
Directly with the script export, can not temporarily modify the template.
Can you automatically modify the name when exporting?
Then only call the ID software comes with the interface to export PDF?
Copy link to clipboard
Copied
Yes, you're correct!
Copy link to clipboard
Copied
I can modify the script to allow selecting the preset through a small GUI and let you know.
Copy link to clipboard
Copied
Very much looking forward to it.
Thanks.
Copy link to clipboard
Copied
var myDocument = app.activeDocument;
var myFileName = myDocument.name.replace(/\.indd$/, ''); // Remove the .indd extension
var myDate = new Date();
var myYear = myDate.getFullYear();
var myMonth = ("0" + (myDate.getMonth() + 1)).slice(-2); // Add leading zero
var myDay = ("0" + myDate.getDate()).slice(-2); // Add leading zero
var myFormattedDate = myYear + "-" + myMonth + "-" + myDay;
var myPDFFile = new File(myDocument.filePath + "/" + myFormattedDate + "-" + myFileName + ".pdf");
// Create a dialog for selecting the PDF export preset
var myDialog = new Window('dialog', 'Select PDF Export Preset');
myDialog.orientation = 'column';
myDialog.alignChildren = 'left';
var myDropdown = myDialog.add('dropdownlist', undefined, app.pdfExportPresets.everyItem().name);
myDropdown.selection = 0;
var myButtonGroup = myDialog.add('group');
myButtonGroup.orientation = 'row';
myButtonGroup.add('button', undefined, 'OK', {name: 'ok'});
myButtonGroup.add('button', undefined, 'Cancel', {name: 'cancel'});
if (myDialog.show() == 1) {
var myPDFExportPreset = app.pdfExportPresets.item(myDropdown.selection.text);
myDocument.exportFile(ExportFormat.PDF_TYPE, myPDFFile, false, myPDFExportPreset);
} else {
alert('Export canceled');
}
Copy link to clipboard
Copied
Thank you very much, it runs great.
Just that sometimes the original PDF file is already open and it prompts an error.
There can be a prompt “PDFfile is opening”
Am I correct in this modification?
try{
if (myDialog.show() == 1) {
var myPDFExportPreset = app.pdfExportPresets.item(myDropdown.selection.text);
myDocument.exportFile(ExportFormat.PDF_TYPE, myPDFFile, false, myPDFExportPreset);
} else {
alert('Export canceled');
}
}
catch (e){alert ("PDFfile is opening……")}
Copy link to clipboard
Copied
How to determine the PDF file already exists?
For example:
if "2025-02-08-myfile.pdf" already exists, can it be saved as
2025-02-08-02-myfile.pdf
Thank you.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Can you set the export range.
Right now it will only use the page number range that was set during the last manual export.
Or it would be nice to be able to export all page numbers by default.
Thank you
Copy link to clipboard
Copied
Hi @m1b
Help look at this.
Can you add a page number setting?
Right now it only executes the last setting, and sometimes it will only export 1 page if you're not paying attention.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now