I have a simple class called "MyPage":
public class MyPage
{
public TextBlock tbParagraph;
public FixedPage page;
public PageContent content;
public MyPage(string Text)
{
tbParagraph = new TextBlock();
page = new FixedPage();
content = new PageContent();
tbParagraph.Text = Text;
page.Children.Add(tbParagraph);
content.Child = page;
}
}
Now I can create a FixedDocument and add 3 pages with the content of "Page1", "Page2" and "Page3" respective to the order:
FixedDocument document = new FixedDocument();
public List<MyPage> listPages = new List<MyPage>();
listPages.Add(new MyPage("Page 1"));
listPages.Add(new MyPage("Page 2"));
listPages.Add(new MyPage("Page 3"));
foreach(MyPage pg in listPages)
{
document.Pages.Add(pg.content);
}
Now is there a way to remove pages from FixedDocument? I know I can clear the specific page content with document.Pages[2].Child.Children.Clear();
for example, but how do I remove a Page itself?