Posted 10 April 2020, 10:59 pm EST
I used ObjectResolvedScript to ensure that a document starts on an odd page if programmed to do so.
If the document is going to be rendered on an even page then the script below uses LayoutChangeNewPage to insert a blank page without header and footer, forcing the document is to starts on an odd page.
The issue is that the blank page sometimes is output that contains header and footer.
Script:
</```
RenderEmpty re = new RenderEmpty();
re.ObjectResolvedScript =
“if MultiDocument.PageCount mod 2 = 0 then\r\n” +
" Dim lc As LayoutChangeNewPage = New LayoutChangeNewPage()\r\n" +
" lc.PageLayout = New PageLayout()\r\n" +
" lc.PageLayout.Pageheader = New RenderEmpty()\r\n" +
" lc.PageLayout.PageFooter = New RenderEmpty()\r\n" +
" Document.Body.Children(RenderObject.IndexInOwner + 1).LayoutChangeAfter = lc\r\n" +
“else\r\n” +
" Document.Body.Children(RenderObject.IndexInOwner + 1).LayoutChangeAfter = Nothing\r\n" +
“end if”;
doc.Body.Children.Add(re);
doc.Body.Children.Add(new RenderEmpty());
An example that show this behaviour can be loaded here:
-Joginder Nahil
[zip filename="PageBreakTest.zip"]https://gccontent.blob.core.windows.net/forum-uploads/file-22a36a9f-56a9-471d-80ce-5de9436aa59e.zip[/zip]