I need to save a large stackpanel to an XPS document. Since the stackpanel is lengthy, it cannot be accommodated in a single page while printing. Is there a way to save the stackpanel in XPS expanding multiple pages?
Below is my code that saves a single page:
Transform transform = stkpnlMain.LayoutTransform;
stkpnlMain.LayoutTransform = null;
Size size = new Size(stkpnlMain.ActualWidth, stkpnlMain.ActualHeight);
stkpnlMain.Measure(size);
stkpnlMain.Arrange(new Rect(size));
Package package = Package.Open(destination.LocalPath, FileMode.Create);
XpsDocument doc = new XpsDocument(package);
XpsDocumentWriter writer = XpsDocument.CreateXpsDocumentWriter(doc);
writer.Write(stkpnlMain);
doc.Close();
package.Close();
Here, stkpnlMain is a very lengthy block.