1.算法程序
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
2.作者答疑
如有疑问,请留言。
提示: 作者知了-联系方式1
提示: 作者知了-联系方式2