• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
8

Javascript pour exporter en pdf les variantes de mise en page

Explorer ,
Jan 09, 2024 Jan 09, 2024

Copy link to clipboard

Copied

Bonjour à tous,

 

Je souhaiterai exporter l'ensemble de mes variantes de mise en page d'un meme fichier dans des pdfs distinct. Est ce que quelqu'un saurait comment faire s'il vous plait ? Je ne trouve aucune formulation qui fonctionne.

 

Cordialement,

Claire.

 

TOPICS
Import and export , Print , Scripting

Views

196

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jan 09, 2024 Jan 09, 2024

Hi @Claire_Chr , With JS you can get the document’s alternate layer names via sections, so something like this might work—the dialog asks you to select a PDF preset then exports each layout as an alternate layout page range to your document’s parent folder:

 

makeDialog();
var pp;
function makeDialog(){
    var theDialog = app.dialogs.add({name:"Choose a Preset", canCancel:true});
    with(theDialog.dialogColumns.add()){
        pp = dropdowns.add({stringList:app.pdfExportPresets.everyItem().na
...

Votes

Translate

Translate
Community Expert ,
Jan 09, 2024 Jan 09, 2024

Copy link to clipboard

Copied

LATEST

Hi @Claire_Chr , With JS you can get the document’s alternate layer names via sections, so something like this might work—the dialog asks you to select a PDF preset then exports each layout as an alternate layout page range to your document’s parent folder:

 

makeDialog();
var pp;
function makeDialog(){
    var theDialog = app.dialogs.add({name:"Choose a Preset", canCancel:true});
    with(theDialog.dialogColumns.add()){
        pp = dropdowns.add({stringList:app.pdfExportPresets.everyItem().name, selectedIndex:3, minWidth:80});
    }
    if(theDialog.show() == true){
        pp = app.pdfExportPresets.item(pp.selectedIndex);
        exportLayouts();
        theDialog.destroy();
	}
}


function exportLayouts(){
	var doc = app.activeDocument
	//gets an array of alternate layout names
	var pr = doc.sections.everyItem().alternateLayout;
	for (var i = 0; i < pr.length; i++){
		app.pdfExportPreferences.properties = {pageRange:pr[i], viewPDF:false }
		doc.exportFile(ExportFormat.pdfType, File(doc.filePath + "/" + pr[i] + ".pdf"), false, pp);
	};
}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines