Specifies paper size.
Namespace: SautinSoft.DocumentAssembly: SautinSoft.Document (in SautinSoft.Document.dll) Version: 2024.4.24
Syntax Public Enumeration PaperType
Members Member name | Value | Description |
---|
A0 | 0 |
841 x 1189 mm.
|
A1 | 1 |
594 x 841 mm.
|
A2 | 2 |
420 x 594 mm.
|
A3 | 3 |
297 x 420 mm.
|
A4 | 4 |
210 x 297 mm.
|
A5 | 5 |
148 x 210 mm.
|
A6 | 6 |
105 x 148 mm.
|
A7 | 7 |
74 x 105 mm.
|
B0 | 8 |
1000 x 1414 mm.
|
B1 | 9 |
707 x 1000 mm.
|
B2 | 10 |
500 x 707 mm.
|
B3 | 11 |
353 x 500 mm.
|
B4 | 12 |
250 x 353 mm.
|
B5 | 13 |
176 x 250 mm.
|
B6 | 14 |
125 x 176 mm.
|
B7 | 15 |
88 x 125 mm.
|
C0 | 16 |
917 x 1297 mm.
|
C1 | 17 |
648 x 917 mm.
|
C2 | 18 |
458 x 648 mm.
|
C3 | 19 |
324 x 458 mm.
|
C4 | 20 |
229 x 324 mm.
|
C5 | 21 |
162 x 229 mm.
|
C6 | 22 |
114 x 162 mm.
|
C7 | 23 |
81 x 114 mm.
|
Letter | 24 |
216 x 279 mm.
|
Legal | 25 |
216 x 356 mm.
|
LedgerTabloid | 26 |
279 x 432 mm.
|
Executive | 27 |
190 x 254 mm.
|
Paper11x17 | 28 |
279 x 432 mm.
|
EnvelopeDL | 29 |
110 x 220 mm.
|
EnvelopeC5 | 30 |
162 x 229 mm.
|
EnvelopeC6 | 31 |
114 x 162 mm.
|
Custom | 32 | |
Example See Developer Guide: How to adjust a document page properties
How to adjust a document page properties using C#
using SautinSoft.Document;
namespace Sample
{
class Sample
{
static void Main(string[] args)
{
PageProperties();
}
public static void PageProperties()
{
string documentPath = @"PageProperties.docx";
DocumentCore dc = new DocumentCore();
Section section1 = new Section(dc);
section1.PageSetup.PaperType = PaperType.B5;
section1.PageSetup.Orientation = Orientation.Landscape;
section1.PageSetup.PageMargins = new PageMargins()
{
Top = LengthUnitConverter.Convert(50, LengthUnit.Millimeter, LengthUnit.Point),
Right = LengthUnitConverter.Convert(1, LengthUnit.Inch, LengthUnit.Point),
Bottom = LengthUnitConverter.Convert(10, LengthUnit.Millimeter, LengthUnit.Point),
Left = LengthUnitConverter.Convert(2, LengthUnit.Centimeter, LengthUnit.Point)
};
dc.Sections.Add(section1);
section1.Content.Start.Insert("Shrek, a green ogre who loves the solitude in his swamp, " +
"finds his life interrupted when many fairytale characters are " +
"exiled there by order of the fairytale-hating Lord Farquaad.", new CharacterFormat() { FontName = "Times New Roman", Size = 14.0 });
section1.Content.End.Insert(new SpecialCharacter(dc, SpecialCharacterType.PageBreak).Content);
Section section2 = new Section(dc);
section2.PageSetup.PaperType = PaperType.A4;
section2.PageSetup.Orientation = Orientation.Portrait;
section2.PageSetup.PageMargins = new PageMargins()
{
Top = LengthUnitConverter.Convert(5, LengthUnit.Millimeter, LengthUnit.Point),
Right = LengthUnitConverter.Convert(5, LengthUnit.Millimeter, LengthUnit.Point),
Bottom = LengthUnitConverter.Convert(5, LengthUnit.Millimeter, LengthUnit.Point),
Left = LengthUnitConverter.Convert(5, LengthUnit.Millimeter, LengthUnit.Point)
};
dc.Sections.Add(section2);
Paragraph p = new Paragraph(dc);
p.Content.Start.Insert("Shrek tells them that he will go ask Farquaad to send them back. " +
"He brings along a talking Donkey who is the only fairytale creature who knows the way to Duloc.",
new CharacterFormat() { FontName = "Times New Roman", Size = 14.0 });
p.ParagraphFormat.Alignment = HorizontalAlignment.Justify;
section2.Blocks.Add(p);
dc.Save(documentPath);
System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(documentPath) { UseShellExecute = true });
}
}
}
How to adjust a document page properties using VB.Net
Imports System
Imports System.IO
Imports SautinSoft.Document
Module Sample
Sub Main()
PageProperties()
End Sub
Sub PageProperties()
Dim documentPath As String = "PageProperties.docx"
Dim dc As New DocumentCore()
Dim section1 As New Section(dc)
section1.PageSetup.PaperType = PaperType.B5
section1.PageSetup.Orientation = Orientation.Landscape
section1.PageSetup.PageMargins = New PageMargins() With {
.Top = LengthUnitConverter.Convert(50, LengthUnit.Millimeter, LengthUnit.Point),
.Right = LengthUnitConverter.Convert(1, LengthUnit.Inch, LengthUnit.Point),
.Bottom = LengthUnitConverter.Convert(10, LengthUnit.Millimeter, LengthUnit.Point),
.Left = LengthUnitConverter.Convert(2, LengthUnit.Centimeter, LengthUnit.Point)
}
dc.Sections.Add(section1)
section1.Content.Start.Insert("Shrek, a green ogre who loves the solitude in his swamp, " & "finds his life interrupted when many fairytale characters are " & "exiled there by order of the fairytale-hating Lord Farquaad.", New CharacterFormat() With {
.FontName = "Times New Roman",
.Size = 14.0
})
section1.Content.End.Insert((New SpecialCharacter(dc, SpecialCharacterType.PageBreak)).Content)
Dim section2 As New Section(dc)
section2.PageSetup.PaperType = PaperType.A4
section2.PageSetup.Orientation = Orientation.Portrait
section2.PageSetup.PageMargins = New PageMargins() With {
.Top = LengthUnitConverter.Convert(5, LengthUnit.Millimeter, LengthUnit.Point),
.Right = LengthUnitConverter.Convert(5, LengthUnit.Millimeter, LengthUnit.Point),
.Bottom = LengthUnitConverter.Convert(5, LengthUnit.Millimeter, LengthUnit.Point),
.Left = LengthUnitConverter.Convert(5, LengthUnit.Millimeter, LengthUnit.Point)
}
dc.Sections.Add(section2)
Dim p As New Paragraph(dc)
p.Content.Start.Insert("Shrek tells them that he will go ask Farquaad to send them back. " & "He brings along a talking Donkey who is the only fairytale creature who knows the way to Duloc.", New CharacterFormat() With {
.FontName = "Times New Roman",
.Size = 14.0
})
p.ParagraphFormat.Alignment = HorizontalAlignment.Justify
section2.Blocks.Add(p)
dc.Save(documentPath)
System.Diagnostics.Process.Start(New System.Diagnostics.ProcessStartInfo(documentPath) With {.UseShellExecute = True})
End Sub
End Module
See Also