Copy link to clipboard
Copied
Hi All,
Good Day. I need to make 4 page document into 2 page like below. The width will be twice before moving the page 4 into 1
Source Final
The below coding Is I wrote for Indesign.
var myDoc=app.documents[0];
var mywidth=myDoc.documentPreferences.pageWidth;
var myheight=myDoc.documentPreferences.pageHeight;
var myX = (myDoc.pages[0].bounds[3] - myDoc.pages[0].bounds[1] );
var myY = (myDoc.pages[1].bounds[3] - myDoc.pages[1].bounds[1] );
myDoc.documentPreferences.pageWidth=mywidth*2;
myDoc.viewPreferences.rulerOrigin = RulerOrigin.PAGE_ORIGIN;
app.activeWindow.transformReferencePoint = AnchorPoint.TOP_LEFT_ANCHOR;
myDoc.pages[1].pageItems.everyItem().move(myDoc.pages[1], [-myX,0]);
myDoc.pages[2].pageItems.everyItem().duplicate(myDoc.pages[1], [0,0]);
myDoc.pages[3].pageItems.everyItem().duplicate(myDoc.pages[0], [-myX,0]);
myDoc.pages[3].remove();
myDoc.pages[2].remove();
I need the same functionality into PDF. I know about Quite Imposing plugin, but our team like to do this in script.
Please give me some suggestion, if anybody have this script then it would be great if you share those.
PS: I found one interesting link... Small imposition script: Where to start?
Thanks,
K
Copy link to clipboard
Copied
The question seems to have been answered in the thread you linked to... Did you try using the code provided there?
Copy link to clipboard
Copied
Hi try67,
Yes I tried. It is used for button to give the result. I am very basic in PDF scripting. The overlay concept is useful I think. But not sure how to use that.
Thanks,
K
Copy link to clipboard
Copied
So what are you looking for, exactly? The code is available, more or less. If you wish someone to adjust it to your specific needs and convert it into a script that can be executed using a button, feel free to contact me privately (try6767 at gmail.com) and we could discuss it further.
Copy link to clipboard
Copied
Hi try67,
I dont need any button. Just want to know how to modify the Indesign script into PDF script. What will I need to change.
Thanks,
K
Copy link to clipboard
Copied
InDesign and Acrobat are using completely different JavaScript implementations. This means that you cannot just port a script from one environment to the other, you will have to start a new script from scratch.
Copy link to clipboard
Copied
Hi Karl,
Thank you for the suggestion. I thought I can use the same logic for PDF script except the keywords in coding. Maybe the object model differs.
Regards,
K
Copy link to clipboard
Copied
The object model is completely different, there is no overlap. To use the same logic, take the script form the question you linked to originally and build something based on that. It might be cheaper (and a lot easier) to just go with Quite Imposing.
Copy link to clipboard
Copied
Hi Karl,
Thanks again for your suggestion. Let I try and let you know if I need any assistance.
Regards,
K
Copy link to clipboard
Copied
Hi Karl/try67,
Here is my script which approach with watermark concept. This is working fine. Please validate and let me know if this script will cause any error in future.
var pt2inch = 72;
var rectCrop = this.getPageBox();
var rotWidth = rectCrop[2]-rectCrop[0];
newPage({nWidth: rotWidth * 2})
newPage({nWidth: rotWidth * 2})
this.addWatermarkFromFile({ cDIPath: this.path, nSourcePage: 0, nStart:4, nEnd: 4, nHorizAlign: 0, nVertAlign: 0, nHorizValue: pt2inch*8.5, nVertValue: 0, nRotation: 0 });
this.addWatermarkFromFile({ cDIPath: this.path, nSourcePage: 3, nStart:4, nEnd: 4, nHorizAlign: 0, nVertAlign: 0, nHorizValue: 0, nVertValue: 0, nRotation: 0 });
this.addWatermarkFromFile({ cDIPath: this.path, nSourcePage: 1, nStart:5, nEnd: 5, nHorizAlign: 0, nVertAlign: 0, nHorizValue: pt2inch*8.5, nVertValue: 0, nRotation: 0 });
this.addWatermarkFromFile({ cDIPath: this.path, nSourcePage: 2, nStart:5, nEnd: 5, nHorizAlign: 0, nVertAlign: 0, nHorizValue: 0, nVertValue: 0, nRotation: 0 });
this.deletePages({nStart: 0, nEnd: 3});
Here is the sample file
Thanks,
K
Copy link to clipboard
Copied
How are we supposed to know if it will cause errors in the future? We're
not soothsayers... If in the future it doesn't work, for some reason,
you'll need to fix it.
Copy link to clipboard
Copied
PS. this script does not produce the output you described in your original post. The last two pages are in reverse order (3-2 instead of 2-3)...
Copy link to clipboard
Copied
Hi try67,
Thank you for pointing the page reverse order. I am novice in PDF scripting so just asked your kind opinion about the future cause error if anything you see obvious in the code. I know all of us are not soothsayers.
Thanks for your valuable suggestions.
Regards,
K
Find more inspiration, events, and resources on the new Adobe Community
Explore Now