文章目录
1.算法程序
- 1.算法程序
- 2.作者答疑
Adobe InDesign是Adobe公司的一个桌面出版 (DTP) 的应用程序,主要用于各种印刷品的排版编辑。InDesign可以将文档直接导出为Adobe的PDF格式,而且有多语言支持。采用脚本语言自动化编码,在学习中的一个重要功能是多页PDF导入功能,以下源代码仅用于学习交流,请勿用于商业用途和其它非法用途。源代码如下所示:
//PlacePDFPages.js
//Select the file you want to place.
var myFile = File.openDialog("Select the file you want to place", "");
//Create a dialog.
var myDialog = app.dialogs.add({name:"PDF多页面导入",canCancel:true});
with(myDialog){
//Add a dialog column.
with(dialogColumns.add()){
//Create First border panel.
with(borderPanels.add()){
with(dialogColumns.add()){
staticTexts.add({staticLabel:"导入PDF从第1页到第n页:"});
}
with(dialogColumns.add()){
//Create a number entry field.Note that this uses editvalue
//rather than editerText (as a textBox would).
var LastPagesNumField = realEditboxes.add({editValue:5});
}
}
//Create Second border panel.
with(borderPanels.add()){
with(dialogColumns.add()){
staticTexts.add({staticLabel:"PDF页面左上角定位于X坐标(mm):"});
}
with(dialogColumns.add()){
//Create a number entry field.Note that this uses editvalue
//rather than editerText (as a textBox would).
var TopLeftXField = realEditboxes.add({editValue:0});
}
}
//Create Third border panel.
with(borderPanels.add()){
with(dialogColumns.add()){
staticTexts.add({staticLabel:"PDF页面左上角定位于Y坐标(mm):"});
}
with(dialogColumns.add()){
//Create a number entry field.Note that this uses editvalue
//rather than editerText (as a textBox would).
var TopLeftYField = realEditboxes.add({editValue:0});
}
}
}
}
//Display the dialog box.
if(myDialog.show() == true){
//Get the LastPagesNum from the LastPagesNumField.
LastPagesNum = LastPagesNumField.editValue;
TopLeftX=TopLeftXField.editValue;
TopLeftY=TopLeftYField.editValue;
var myDocument = app.activeDocument;
myDocument.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.millimeters;
myDocument.viewPreferences.verticalMeasurementUnits = MeasurementUnits.millimeters;
Locat = [TopLeftX, TopLeftY];
app.pdfPlacePreferences.pdfCrop=PDFCrop.cropMedia;
myDocument.documentPreferences.pagesPerDocument = LastPagesNum;
for (i=0; i
关注
打赏
最近更新
- 深拷贝和浅拷贝的区别(重点)
- 【Vue】走进Vue框架世界
- 【云服务器】项目部署—搭建网站—vue电商后台管理系统
- 【React介绍】 一文带你深入React
- 【React】React组件实例的三大属性之state,props,refs(你学废了吗)
- 【脚手架VueCLI】从零开始,创建一个VUE项目
- 【React】深入理解React组件生命周期----图文详解(含代码)
- 【React】DOM的Diffing算法是什么?以及DOM中key的作用----经典面试题
- 【React】1_使用React脚手架创建项目步骤--------详解(含项目结构说明)
- 【React】2_如何使用react脚手架写一个简单的页面?