Copy link to clipboard
Copied
Hi there,
I work on documents with different bleed measurements – 3mm, 5mm, 10mm etc. I am wondering if it is possible to write a script that exports the pdf with bleed and crop marks based on the document's bleed settings. e.g if I have a doc with 5mm bleed, the script will export it with 5mm bleed and 5mm offset for the crop marks. And if I have a doc with 3mm bleed, the same script will do the same but with 3mm bleed and 3mm offset.
Other requirements;
1. I want it to export directly to the same folder the indesign file is in (i.e i don't want a dialogue box to pop up asking where to save).
2. Press quality
3. Have same name as the indesign doc e.g "document.indd" exports "document.pdf"
4. Export to pages (not spread)
5. PDF to open after export completes
Hopefully that covers everthing.
Any help would be greatly appreciated, thank you.
Hi @danielw42205661 , Does the script below work for you?
It gets the existing "_Art" preset and sets the preset’s pageMarksOffset property to the document‘s top bleed amount—as Peter points out the page marks offset is uniform. If _Art does not exist, a new preset named _Art is made based on a chosen existing preset—[Press Quailty] in this case:
main()
function main(){
var doc = app.activeDocument;
if (!doc.saved) {
alert("Please Save")
return
}
var tb =
...
Copy link to clipboard
Copied
Create a joboption. Use the given means. All is available to preset on board when you export PDFs from InDesign. Nothing is missing.
Copy link to clipboard
Copied
Fortunately scripting exists so we dont have to just use the given means. I'd much prefer to literally press one button on my keypad to export a pdf (assigning shortcut to a script), instead of doing command+e, click save, change pdf preset, click export.
Copy link to clipboard
Copied
Choose a PDF JOBOPTION and InDesign will export. When you have saved a PDF JOBOPTIONS once you need not to change it anymore. I do not see any advantage to create a script as it is no shortcut.
Copy link to clipboard
Copied
Sure, how do you choose a joboption? Does it require more than one press of a key?
For example, I have a script set up to export a pdf at medium res and have assigned a shortcut to it. I have remapped the "/" key on my keypad to run this script, so if I want to export a medium res pdf, I literally press the "/" key on my kepad and it exports it. Doesnt give me a dialog box asking me where to save or anything. If your joboptions method can do this, I will jump at it.
Copy link to clipboard
Copied
When you have a joboption you can call it from the menu directly. Ok, the dialog opens, but it is only the input key to bypass it. In my opinion, easier to access than any script. In my opinion, a script does not help to speed up things.
Copy link to clipboard
Copied
Thanks for your input. I think we will have to agree to disagree. I don't consider navigating to the joboption from the menu, and bypassing the dialog boxes that come up faster than pressing one key on the numpad. It certainly speeds it up for me.
Copy link to clipboard
Copied
That's perfectly doable with a script. Offer to pay a fee and no doubt someone here will write it for you.
P.
Copy link to clipboard
Copied
Hi Daniel,
the question is, do you have scripting expierence and looking for pointers or do you look for someone who'll write it for you?
If first, then look at
https://www.indesignjs.de/extendscriptAPI/indesign-latest/#PDFExportPreference.html
If the latter, I'm pretty sure there are floating snippets around here in the forums which consists of 4-5 lines which do what you need.
BUT Willi's suggestion about the joboptions are valid nevertheless – create joboptions and then you can simply reference them in your script. Otherwise the script will use the last used export settings aside from the set documentBleed setting.
You would have to define every possible option of pdfExportPreference in your script, which is not very reasonable in my humble opinion.
Copy link to clipboard
Copied
I dont have any scripting experience at all. I've seen countless posts on this site where people have asked about scripts (a lot seemingly more complex than my one), and others will help out and post the code for it. Have a search for "script" and you will see what I mean.
It's clear that that will not happen in this case, which is fine. I will survive without it, would have just been a good workflow improvement.
I still dont get the joboptions rationale, compared to my hypothetical script. I would need to create countless joboptions e.g a separate one for 3mm, 5mm, 15mm, 20mm and on and on etc bleed. If there was a script that got the bleed information from the document, applied it, and then chose the same number for the crop offset, you would literally just need the one script and it would work with whatever bleed was set up for the document. Alas.
Copy link to clipboard
Copied
Daniel -- I don'y rhink you need a script. Simply check the option 'Use document bleed settings' in an export preset (and save the preset). Then any time you export a document its bleed settings are used in the PDF.
Does that work for you?
P.
Copy link to clipboard
Copied
Hi,
I echo the sentiments of other reply. Inside each jobopitons, there is a checkbox to use each documents' bleeds, so you don't need differnt joboptions just beasue of different bleeds. It's easier to maintain a script by referencing the joboptions, rather than have all the joboptions listed in a script. There are tons of other options that one might need to change.
You can find script that already does what you ask. All you have to do is change that one line to use the modifed Press Quality jopoptions. Duplicate the default Press Quality joboptions and change the doc's bleed, the crops, length, etc.
Copy link to clipboard
Copied
I have the script below, which references a joboption set up to export at 3mm and 3mm crop offset. I have assigned this a shortcut and mapped a key on my keypad ("/") to export it. That's great, but what if I'm on a document set up with 5mm bleed that I want to export at 5mm bleed and 5mm offset. I'll have to create another joboption and combine with the script script and assign it to another key on my keypad to execute that one right? So because I deal with documents with multiple bleed settings, I'm going to end up with a bunch of keys each with bleed specific scripts assigned to them. But I only want to have to press one key that exports it at no matter what bleed setting it is. Hence, the reason why I don't want to use the joboption route. I know nothing about scripts, but if it were possible to create a script that says export the document using the bleed the document is set up as, AND apply the crop marks at the same measurement (a requirement from my work), then I could have the one shortcut keypad key and it will work no matter what bleed.
Again, just to clarify, I like the simplicity and speed of pressing one key and it exporting, not having to command+e, deal with save as dialogue boxes, choosing an export setting from a drop box etc.
main();
function main(){
d = app.activeDocument;
// Here you can choose the PDF preset
cx
preset1 = app.pdfExportPresets.itemByName(“_Art”);
if (!(preset1.isValid)){
alert(“One of the presets does not exist. Please check spelling carefully.”);
exit();
}
if (d.saved){
thePath = String(d.fullName).replace(/\..+$/, ““) + “.pdf”;
}
thePath = thePath.replace(/\.pdf$/, “”);
name1 = thePath+”.pdf”;
// Here you can set the suffix at the end of the name
d.exportFile(ExportFormat.PDF_TYPE, new File(name1), false, preset1);
}
Copy link to clipboard
Copied
Daniel,
All you need to do is to open the _Art preset, check the 'Use document bleed settings', and save it. Then you can use your script and the exported PDF will have the document's bleeds applied.
P.
Copy link to clipboard
Copied
That is checked already, but the crop offset is set to 3mm (I have to have the crop offset the same measurement as the bleed). As far as I can tell, there is no way in presets to specify this. It is an absolute number, in the case of my script, the crop offset is set to 3mm. So if I have document set up at 10mm bleed, it's going to offset crop marks to 3mm, not 10mm.
Copy link to clipboard
Copied
Aha. The problem is not the bleed settings -- that works fine in the PDF export -- but the crop marks. So you want the rop marks adjusted to the largest bleed value? Because bleed marks can be set to four different values (top, bottom, etc.) but there's only one general value for the crop marks.
Copy link to clipboard
Copied
Hi @danielw42205661 , Does the script below work for you?
It gets the existing "_Art" preset and sets the preset’s pageMarksOffset property to the document‘s top bleed amount—as Peter points out the page marks offset is uniform. If _Art does not exist, a new preset named _Art is made based on a chosen existing preset—[Press Quailty] in this case:
main()
function main(){
var doc = app.activeDocument;
if (!doc.saved) {
alert("Please Save")
return
}
var tb = doc.documentPreferences.documentBleedTopOffset;
var fp = doc.filePath + "/" + doc.name.replace(/\.[^\.]+$/, '') + "art.pdf"
//get the existing _Art preset of make one based on [Press Quality]
var preset = makePDFPreset("_Art", app.pdfExportPresets.itemByName("[Press Quality]"));
preset.properties = {useDocumentBleedWithPDF:true, cropMarks:true, pageMarksOffset:tb}
app.pdfExportPreferences.properties={pageRange:PageRange.ALL_PAGES, viewPDF:true}
doc.exportFile(ExportFormat.pdfType, File(fp), false, preset);
}
/**
* Gets an existing PDF preset, or makes a new named PDF Preset based on an existing preset
* @ param the preset name
* @ param based on preset
* @ return the pdf preset
*/
function makePDFPreset(n, bo){
var ps = app.pdfExportPresets.itemByName(n);
if (ps.isValid) {
return ps;
} else {
ps = app.pdfExportPresets.add({name:n});
ps.properties = bo.properties;
return ps;
}
}
Example with .5" top bleed:
Copy link to clipboard
Copied
Thank you Rob!! This is exactly what I was after. I really appreciate it.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now