Copy link to clipboard
Copied
I'm having trouble. I am changing the page size to crop then exporting to jpeg. Then I change the page size back works great but the master page becomes disconnected. I can't figure out how to apply it again.
I am trying something like this
var myDocument=app.activeDocument;
var curPage = myDocument.pages[1];
X=curPage.appliedMaster;
This does nothing.
A point in the right direction would help alot thanks.
Brett G
Hi colleagues,
OK, my two pennies on this topic.
Reframing pages is always a dangerous sport, especially in a facing-page document. Indeed, since those facing pages are not supposed to undergo any 'move' along the X-axis, each time a reframe occurs that involves changing X coordinates, many unexpected things may happen behind the scene. The page geometry is modified, its translation attributes are readjusted in its transformation matrix, the relationship with the master spread may be somehow alter
...Copy link to clipboard
Copied
Can't you store the applied master to a variable before cropping and apply it again after resizing the page?
Also check the value for layoutRule of the applied master. There are 7 options to choose from.
Regrads,
Uwe
Copy link to clipboard
Copied
I think you could make that a variable. I need to know how to apply it.
Copy link to clipboard
Copied
See the DOM documentation for the Page Object and look for the appliedMaster property.
Copy link to clipboard
Copied
Okay. Here is what I think I'm going to do. Because the master stays applied to the even pages of the spread. I can use that master and apply it to the odd pages. This is how I'm going to do it.
var myDocument=app.activeDocument;
var curPage = myDocument.pages[0];
var curPage1 = myDocument.pages[1];
curPage1.appliedMaster=curPage.appliedMaster;///here is the magic////////
Copy link to clipboard
Copied
If it's working for you, it's working for you. 🙂
I cannot comment on this, because I cannot not see your document.
Best,
Uwe
Copy link to clipboard
Copied
The problem I am having now is with the applied master. On the odd page of the spread the master is not getting applied correctly. The master is applying on top of the even page. I think it may be a mater of master applied to spread vs. page.
Do you know how to apply a master to spread? Or allpage items?
Copy link to clipboard
Copied
Okay here is what i think I need to do in the script. Because I have done it manually and it works. First change applied master to none all page items. This removes the master from both pages of the spread. Then apply the master to that page after the page has changed choosing keep current size. Any ideas on how to do this in the script?
Copy link to clipboard
Copied
Hi Brett,
as I already said: without a test document at hand I cannot help here much.
Please, make one available. Best through your Dropbox account and post the link here.
Then I am able to see into the issues.
Regards,
Uwe
Copy link to clipboard
Copied
I was just taking a look at LayoutRuleOptions and it looks like this is a parameter of createAlternateLayout. The thing I don't understand is why InDesign applies the master on the facing page side to the first page in the spread after you reframe.
I am considering pulling everything off the master and putting it on the page before I reframe. Thoughts?
Copy link to clipboard
Copied
myPage.reframe(CoordinateSpaces.INNER_COORDINATES, [[myX1, myY1], [myX2, myY2]]);
///////EXPORT AFTER THIS THEN RETURN TO NORMAL////////////////
if(differ!=0){
curPage1.appliedMaster=null;
curPage=curPage1[i-1];
curPage.appliedMaster=null;
curPage1.appliedMaster = app.activeDocument.masterSpreads.itemByName("A-Document Master");
}
I just need to know how in script do you say Master Page Size conflict choose keep current page size.
It seems to default to "Use master page size. The test document is just two pages. It has content that goes across the spread on the master page.
Copy link to clipboard
Copied
Because I cannot see into your document, the following is pure guesswork. And you did not post a screenshot.
I think, at least you could have provided an empty document in the state after the transform of the page was reverted.
I cannot find an option in the scripting DOM to do "Keep current page size".
So I only have a workaround for you. Could work with your document or not. Don't know…
Try to duplicate the transformed and reverted spread as a master spread and apply that.
Then there should be no conflict.
A document with some resized pages by the Page Tool of the UI.
I know, you said you redid the transformation of the page, so this is only for clarifying my point:
Before running the snippet below:
app.documents[0].spreads[0].duplicate( LocationOptions.AFTER , app.documents[0].masterSpreads[0] );
app.documents[0].masterSpreads[1].pageItems.everyItem().remove();
app.documents[0].spreads[0].appliedMaster = app.documents[0].masterSpreads[1];
After running the snippet above:
Do not assign the master [None] before.
Regards,
Uwe
Copy link to clipboard
Copied
Ähm, just to say it:
If you want to export something on your page, there is no need to crop the page. Simply group the objects and export the selection.
Kai
Copy link to clipboard
Copied
True. However, that's not my cup of tea…
Let's assume the whole page is needed, because objects from the applied master should be exported as well.
Or that a PDF or an EPS should be exported.
Uwe
Copy link to clipboard
Copied
OK .
I did not read everything here, but: If this task is complicated, why not save the document, do all your stuff and close it without saving it?
Copy link to clipboard
Copied
That's a valid workaround.
But I'm after solving or avoiding the core problem.
And I have no clue what Brett is exactly doing before he tries to apply the master.
Maybe he has to work with two transformation matrices instead of using reframe().
Let's see what he is saying…
Uwe
Copy link to clipboard
Copied
So if I remove all the applied masters one at a time and then replace them it works except for the fact that when they get applied it resizes to master instead of remaining the same. Also if I remove as spread and apply as spread. I get a duplicate master on the even page side. I really appreciate your input. I am also wondering if I could just reframe the master?
Copy link to clipboard
Copied
Brett,
could you please explain step-by-step what you like to do?
From A to Z. And provide document samples for every step. Code samples as well.
I really have no idea what's going on.
Your reframe() function obviously in not bringing back the old state of the page.
And that's the culprit.
Thank you,
Uwe
Copy link to clipboard
Copied
1.Step one change page size to crop document.
2. Depends if its an odd page. I want to export to jpg. But indesign disconnects the master on the odd page side.
So then I have to re apply the master.
3.Export the jpeg
4. Return everything back to normal. I am changing the page size again and re applying the master.
Copy link to clipboard
Copied
Can you change the master page size?
Copy link to clipboard
Copied
I am googling. I found this thread which may account for the problem I am having.
Copy link to clipboard
Copied
var myDocument=app.activeDocument;
var docName=my Docu.name;
docName=docName.slice(0,-12);
var curPage1 = myDocument.pages;
for (var i = 0; i < curPage1.length; i++) {
app.jpegExportPreferences.jpegQuality = JPEGOptionsQuality.high;
app.jpegExportPreferences.exportResolution = 170;///////////800 size
app.jpegExportPreferences.jpegExportRange = ExportRangeOrAllPages.exportRange;
nPgName=curPage1.name;
if ((nPgName.length<3)&&(nPgName.length>1)){
nPgName=("0"+nPgName);
}
if(nPgName.length<2){
nPgName=("00"+nPgName);
}
/////////////////////////////////////////////////
document.viewPreferences.rulerOrigin = RulerOrigin.SPINE_ORIGIN;
document.zeroPoint = [0, 0];
var myPage = curPage1.item(i);
//Y=myPage.marginPreferences.bottom=72;
pnum = curPage1.name;
differ=pnum%2;
var myBounds = myPage.bounds;
var myY1 = myBounds[0]+12.225;
if(differ==0){
var myX1 = myBounds[1]+12.225;
var myX2 = myBounds[3];
}
else{var myX1 = myBounds[1];var myX2 = myBounds[3]-12.225;}
var myY2 = myBounds[2]-119;
myPage.reframe(CoordinateSpaces.INNER_COORDINATES, [[myX1, myY1], [myX2, myY2]]);
///////EXPORT AFTER THIS THEN RETURN TO NORMAL////////////////
if(differ!=0){
curPage1.appliedMaster=null;
curPage=curPage1[i-1];
curPage.appliedMaster=null;
//curPage1.appliedMaster=curPage.appliedMaster;/////is currently applying the master of page even
curPage1.appliedMaster = app.activeDocument.masterSpreads.itemByName("A-Document Master");
//alert(curPage.name+" "+curPage1.name);
}
////////////////////////////////////////////////
var poop=app.jpegExportPreferences.pageString =curPage1.name.toString();
myFilePath="/Volumes/Testing/binuscan Test/BookViewerTest/"+docName+nPgName+".jpg";
myFile=new File(myFilePath);
myDocument.exportFile(ExportFormat.JPG, myFile);
myPage.reframe(CoordinateSpaces.INNER_COORDINATES, [[myBounds[1], myBounds[0]], [myBounds[3], myBounds[2]]]);
//pnum = curPage1.name;
//differ=pnum%2;
if(differ!=0){
curPage=curPage1[i-1];
curPage1.appliedMaster=curPage.appliedMaster;
//curPage1.appliedMaster = app.activeDocument.masterSpreads.itemByName("A-Document Master");
//alert(curPage.name+" "+curPage1.name);
}
}
Copy link to clipboard
Copied
Okay for those of you who have grown tired of this long post I am sorry. I believe I have gotten closer to solving my problem. The items on the master page that are moving are moving because they are on the pasteboard. And InDesign does not like this apparently when resizing. If I fix the pasteboard issue I should not have to re apply the master. I will let you know the final outcome when I finish testing.
Copy link to clipboard
Copied
In the pages panel could you not right click the master page item and go to Panel Options and set the Resize field to "Pages Fixed"? I haven't messed with this but it seems like that should produce the desired result. Just a theory.
Copy link to clipboard
Copied
I'm going in a different direction unless anyone has a better idea.
first I am going to group all of the master page items together. Then apply master null to the odd page removing the master from that page. However the master will continue to show because it is grouped with the first page.
Then export to jpeg.
Then revert back to original.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now