Script for Place PDF file into a InDesign file
hi everyone, need import pdf file indesign document , in order used scripts found over net (e.g. zanelli's script ecc.) tried solution:
function(){ app.scriptpreferences.userinteractionlevel = userinteractionlevels.interactwithall; var mydocument, mypage; if(app.documents.length != 0){ mydocument = app.activedocument; } else{ alert("no document opened"); exit(); } if (app.selection[0] == undefined) { alert("select box"); exit(); } else { var mypdffile = file.opendialog("select pdf:"); if((mypdffile != "")&&(mypdffile != null)){ mydocument.viewpreferences.rulerorigin = rulerorigin.page_origin; mydocument.viewpreferences.horizontalmeasurementunits = measurementunits.millimeters; mydocument.viewpreferences.verticalmeasurementunits = measurementunits.millimeters; var mydata = new array; mydata[0] = app.selection[0].parentpage; mydata[1] = app.selection[0].geometricbounds; mydata[2] = app.selection[0]; myplacepdf(mydocument, mydata, mypdffile); } } //functions function myplacepdf(mydocument, mydata, mypdffile){ var mypdfpage; var mypage = mydata[0]; var mygeometricbounds = mydata[1].tostring().split(","); app.pdfplacepreferences.pdfcrop = pdfcrop.cropmedia; var mycounter = 1; var mybreak = false; while(mybreak == false){ if(mycounter > 1){ mypage = mydocument.pages.add(locationoptions.after, mypage); } app.pdfplacepreferences.pagenumber = mycounter; myrectangle = mypage.rectangles.add(undefined, undefined, undefined, {geometricbounds:[mygeometricbounds[0],mygeometricbounds[1],mygeometricbounds[2],mygeometricbounds[3]]}); myrectangle.clearframefittingoptions(); myrectangle.framefittingoptions.fittingonemptyframe = emptyframefittingoptions.proportionally; myrectangle.framefittingoptions.autofit = true; myrectangle.framefittingoptions.fittingalignment = anchorpoint.center_anchor; mypdfpage = myrectangle.place(file(mypdffile), false)[0]; if(mycounter == 1){ var myfirstpage = mypdfpage.pdfattributes.pagenumber; } else{ if(mypdfpage.pdfattributes.pagenumber == myfirstpage){ mypage.remove(); mybreak = true; } } mycounter = mycounter + 1; } mydata[2].remove(); } }
what is, before script place every single page of pdf file in document, determine if same page of pdf file vertical or horizontal, make right section page.
is possible?
thank you
moved scripting forum...
More discussions in InDesign Scripting
adobe
Comments
Post a Comment