Allows to insert page numbers

Namespace:  SautinSoft
Assembly:  SautinSoft.HtmlToRtf (in SautinSoft.HtmlToRtf.dll) Version: 4.6.10.19

Syntax

      
 C#  Visual Basic 
public HtmlToRtf..::.ePageNumbers PageNumbers { get; set; }
Public Property PageNumbers As HtmlToRtf..::.ePageNumbers

Remarks

You may set values from HtmlToRtf..::.ePageNumbers:

PageNumDisable - disable page numbers
PageNumFirst - page numbers start from 1st page
PageNumSecond - page numbers start from 2nd page

Use this property together with PageNumbersFormat, PageNumbersAlignH and PageNumbersAlignV.

By default: Page numbers is disabled. This is a sample of using this property:

h.PageNumbers = SautinSoft.HtmlToRtf.ePageNumbers.PageNumFirst;
h.PageNumbersAlignH = SautinSoft.HtmlToRtf.eAlign.Right;
h.PageNumbersAlignV = SautinSoft.HtmlToRtf.eAlign.Bottom;
h.PageNumbersFormat = "Page {page} of {numpages}";



Examples

CopyHow to set custom page numbers in RTF document using C#
using System;
using System.IO;

namespace Sample
{
    class Test
    {

        static void Main(string[] args)
        {

            //In this example you will see how to specify page numbers in produced Word/RTF
            //If you need more information about HTML-to-RTF Pro DLL .Net email us at:
            //support[at]sautinsoft.com


            SautinSoft.HtmlToRtf objH = new SautinSoft.HtmlToRtf();
            //objH.Serial = "XXXXXXXXXXXXXXX";

            objH.PageStyle.PageMarginTop.mm(10f);

            //Let's set page numbers from 1st page
            objH.PageNumbers = SautinSoft.HtmlToRtf.ePageNumbers.PageNumFirst;
            //Lest's align page numbers by top-center
            objH.PageNumbersAlignV = SautinSoft.HtmlToRtf.eAlign.Top;
            objH.PageNumbersAlignH = SautinSoft.HtmlToRtf.eAlign.Center;
            //Lest's set page numbers format as "Page 1 of 20"
            objH.PageNumbersFormat = "Page {page} of {numpages}";



            //convert HTML file to RTF file
            int ret = objH.ConvertFile(@"..\..\..\..\..\..\Testing HTMLs\sample1.htm", @"..\..\..\..\..\..\Testing HTMLs\Word document.rtf");

            // 0 - converting successfully
            // 1 - can't open input file or URL, check the input path
            // 2 - can't create output file, check the output path
            // 3 - converting failed
            if(ret==0 )
            {
                //Show produced RTF file
                System.Diagnostics.Process.Start(@"..\..\..\..\..\..\Testing HTMLs\Word document.rtf");
            }
        }
    }
}
CopyHow to set custom page numbers in RTF document using VB.Net
Imports System
Imports System.IO
Imports System.Text

Module Module1
    Sub Main()
        'In this example you will see how to specify page numbers in produced Word/RTF
        'If you need more information about HTML-to-RTF Pro DLL .Net email us at:
        'support[at]sautinsoft.com



        Dim objH As New SautinSoft.HtmlToRtf
        'objH.Serial = "XXXXXXXXXXXXXXX";


        objH.PageStyle.PageMarginTop.mm(10.0F)

        'Let's set page numbers from 1st page
        objH.PageNumbers = SautinSoft.HtmlToRtf.ePageNumbers.PageNumFirst
        'Lest's align page numbers by top-center
        objH.PageNumbersAlignV = SautinSoft.HtmlToRtf.eAlign.Top
        objH.PageNumbersAlignH = SautinSoft.HtmlToRtf.eAlign.Center
        'Lest's set page numbers format as "Page 1 of 20"
        objH.PageNumbersFormat = "Page {page} of {numpages}"


        'convert HTML file to RTF file
        Dim ret As Integer = objH.ConvertFile("..\..\..\..\..\Testing HTMLs\sample1.htm", "..\..\..\..\..\Testing HTMLs\Word document.rtf")

        ' 0 - converting successfully
        ' 1 - can't open input file or URL, check the input path
        ' 2 - can't create output file, check the output path
        ' 3 - converting failed
        If ret = 0 Then
            'Show produced RTF file
            System.Diagnostics.Process.Start("..\..\..\..\..\Testing HTMLs\Word document.rtf")
        End If
    End Sub
End Module

See Also