Hi Sander,
I seem to be getting issues after issues whenever I progress with paginate()
being the center of it all. Here are the things I noticed:
-
When have a simple element <div id="newPage" style="page-break-before: always">
, this works on preview. And creates a new page. But as soon as I call paginate()
, the behaviour of creating a new page fails on this element. What I found works is to set the page-break-before
in post script. Like so query("#newPage#).css("page-break-before", "always"); merge.section.paginate();
then as you can see I call paginate() after.
-
Another issue Im having that maybe connected to cloning happening in my control script.
noticeCount = record.detail.length;
originSection = merge.template.contexts.PRINT.sections["Main Section"];
for(var n = 0; n < noticeCount; n++){
// Clone
var newClone= originSection.clone();
newClone.name = "Main Section " + n;
newClone.enabled = true;
clones[newClone.name] = {index: n, pages: 0 };
originSection.addAfter(newClone)
}
originSection.enabled = false;
whenever I tried doing some manipulation to targeted elements in my post script before triggering paginate() dont work. For eg in my postscript:
Selector: HTML
var element1FromMasterPage = query(".element1");
var element2FromMasterPage = query(".element2");
var newPage = query(".newPageThatNeedsToBreakPage");
element1FromMasterPage.css(“background”, “white”);
element2FromMasterPage.html(“This contains the total page”);
newPage.css(“page-break-before”, “always”);
merge.section.sheetConfig.positions.last.masterBack = “Blank”
merge.section.paginate();
page-break-before
works here, but other manipulation like updating html value or changing background of an element in current master page dont work.
There seems to be a disconnect repaginating the document/ and updating values, applying css to current element.
All these inconsistencies seems to revolve around paginate() and potentially with cloning.
Maybe theres a mechanism at play. That Im missing regarding how paginate works.
Hopefully this all make sense.
Thank you in advanced.
Kind regards,
E
UPDATE: It looks like , I can do away with all the content manipulation, so long as I can assign different media/master pages to specific sheet! I am so close! 