Skip to main content
Inspiring
April 1, 2025
Answered

•  Prevent Acrobat to open when exporting .AI to .PDF via Scripting, possible?

  • April 1, 2025
  • 1 reply
  • 329 views

Hello -

 

I've created a Javscript that does a lot of things, including exporting this open document in .PDF format.
It works… It's just that every time Acobat is launched and it opens the freshly exported .PDF.

 

My question:
Via Javascript, is there any way to prevent Acrobat launching each time? If so, what is this function/command?

Is is via this? But if so does it have priority on the "predefined preset" of the user?

pdfExportOptions_DC.viewAfterSaving = false;

 

Thanks, have a nice day.

 

 

 

- Dimitri

 

Correct answer renél80416020

Bonjour,

Oui cette option a priorité sur le « préréglage prédéfini ».

essayez ce script:

// JavaScript Document
var doc = activeDocument;
var prestlist = app.PDFPresetsList;  alert(prestlist.join("\r"))
var positionDefaut = prompt("Position liste ",0,"EDE elleere");
var docname = doc.name.substring(0,doc.name.lastIndexOf('.'));
var pdfsaveoptions = new PDFSaveOptions();
    pdfsaveoptions.pDFPreset = prestlist[positionDefaut];
//pdfsaveoptions.pDFPreset = "";
    pdfsaveoptions.viewAfterSaving = false;
var targetFile = new File( "~/" + docname + ".pdf" );
    doc.saveAs(targetFile,pdfsaveoptions);
alert(targetFile);
     // doc.close(SaveOptions.DONOTSAVECHANGES);

René

1 reply

renél80416020
renél80416020Correct answer
Inspiring
April 1, 2025

Bonjour,

Oui cette option a priorité sur le « préréglage prédéfini ».

essayez ce script:

// JavaScript Document
var doc = activeDocument;
var prestlist = app.PDFPresetsList;  alert(prestlist.join("\r"))
var positionDefaut = prompt("Position liste ",0,"EDE elleere");
var docname = doc.name.substring(0,doc.name.lastIndexOf('.'));
var pdfsaveoptions = new PDFSaveOptions();
    pdfsaveoptions.pDFPreset = prestlist[positionDefaut];
//pdfsaveoptions.pDFPreset = "";
    pdfsaveoptions.viewAfterSaving = false;
var targetFile = new File( "~/" + docname + ".pdf" );
    doc.saveAs(targetFile,pdfsaveoptions);
alert(targetFile);
     // doc.close(SaveOptions.DONOTSAVECHANGES);

René

Inspiring
April 1, 2025

Bonjour René -

 

Un tout grand merci…

Bonne journée

 

 

 — Dimitri