Skip to content

Commit d749b7e

Browse files
author
KB Bot
committed
Added new kb article richtexteditor-custom-page-size
1 parent d10640b commit d749b7e

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
title: Setting Custom Page Size in RadRichTextEditor for WinForms
3+
description: Learn how to configure a custom page size, such as 3"x3", for documents in RadRichTextEditor.
4+
type: how-to
5+
page_title: How to Configure Custom Page Sizes in RadRichTextEditor for WinForms
6+
slug: radrichtexteditor-winforms-custom-page-size
7+
tags: radrichtexteditor, winforms, custom, page size
8+
res_type: kb
9+
ticketid: 1683831
10+
---
11+
12+
## Environment
13+
14+
<table>
15+
<tbody>
16+
<tr>
17+
<td>Product</td>
18+
<td>RadRichTextEditor for WinForms</td>
19+
</tr>
20+
</tbody>
21+
</table>
22+
23+
## Description
24+
25+
In RadRichTextEditor, I need to set a custom page size, for example, 3"x3". The `ChangePaperTypeCommand` does not allow for custom sizes, and I wonder if there's an alternative way to achieve a custom page size in the document.
26+
27+
This knowledge base article also answers the following questions:
28+
- How can I adjust the page size of a document in RadRichTextEditor?
29+
- Is it possible to define custom dimensions for RadRichTextEditor pages?
30+
- What method allows for custom page sizing in RadRichTextEditor documents?
31+
32+
## Solution
33+
34+
To set a custom page size in RadRichTextEditor, such as 3"x3", use the `ChangeSectionPageSize()` method. This method should be called after the document is loaded. Follow the steps below to implement custom page sizing:
35+
36+
1. Initialize a new size with the desired dimensions. Keep in mind that the size should be specified in DIPs (Document Independent Pixels). For a 3"x3" size, considering 96 DIPs equals 1 inch, calculate the size in DIPs as follows:
37+
38+
```csharp
39+
var size = new Telerik.WinControls.RichTextEditor.UI.Size(762, 762); // 3"x3" in DIPs
40+
```
41+
42+
2. Apply the custom size to the document using the `ChangeSectionPageSize()` method:
43+
44+
```csharp
45+
this.radRichTextEditor1.RichTextBoxElement.ActiveDocumentEditor.ChangeSectionPageSize(size);
46+
```
47+
48+
By applying these steps, you can set a custom page size for your documents in RadRichTextEditor.
49+
50+
## See Also
51+
52+
- [RadRichTextEditor Documentation](https://docs.telerik.com/devtools/winforms/controls/radrichtexteditor/overview)
53+
- [Working with Sections in RadRichTextEditor](https://docs.telerik.com/devtools/winforms/controls/radrichtexteditor/features/sections)
54+
- [Understanding DIPs in Document Processing](https://docs.telerik.com/devtools/document-processing/concepts/dip-units)

0 commit comments

Comments
 (0)