Can you provide instructions or code for reversing the page order in a document? My objective is to reverse the page order so when the user prints to document, the pages are collated.
I started working on a function but it fails when page is composed of two or more sections.
private static Document ReversePageOrder(Document dstDoc)
{
List<Section> list = new List<Section>();
Document revDoc = new Document();
for (int i = dstDoc.Sections.Count - 1; i >= 0; i--)
{
Section dstSection = dstDoc.Sections[i];
Section newSection = (Section)revDoc.ImportNode(dstSection, true, ImportFormatMode.KeepSourceFormatting);
revDoc.Sections.Add(newSection);
}
return revDoc;
}