The page size is a property of the Section class and could be modified following the approach you already found in our documentation. With RadFlowDocumentEditor
you can create and insert a section in the document at the same time as demonstrated in the code snippet below. The InsertSection() method creates a new Section and inserts in the current RadFlowDocument
instance. The method returns the Section object and you can use it for further customizations. Here is how I modified the code in order to achieve the desired goal:
document.Sections.First().PageSize = PaperTypeConverter.ToSize(PaperTypes.A4);
Section section = editor.InsertSection();
Telerik.Windows.Documents.Primitives.Padding(40, 10, 40, 10);
section.PageSize = PaperTypeConverter.ToSize(PaperTypes.A4);
Please, note that inserting text into the empty document automatically creates a Section and a Paragraph where the text will be placed.
RadWordsProcessing is independent of UI and has no notion about how the document should look like. In other words, it is not clear how many pages will be filled and at which page a document element will take place. Thus, it is not possible to find the number of the currently modified page.
Hope this helps.