Set page properties: page size, orientation and page margins
Namespace:
SautinSoftAssembly: SautinSoft.HtmlToRtf (in SautinSoft.HtmlToRtf.dll) Version: 4.6.10.19
Syntax
| C# | Visual Basic |
public HtmlToRtf..::.CPageStyle PageStyle { get; set; }
Public Property PageStyle As HtmlToRtf..::.CPageStyle
Remarks
Examples
using System; using System.IO; namespace Sample { class Test { static void Main(string[] args) { //Set page size and margins in RTF document //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"; //Let's set page size A3, landscape orientation and all margins in 1 inch objH.PageStyle.PageSize.A3(); objH.PageStyle.PageMarginTop.Inch(1.0f); objH.PageStyle.PageMarginRight.Inch(1.0f); objH.PageStyle.PageMarginBottom.Inch(1.0f); objH.PageStyle.PageMarginLeft.Inch(1.0f); objH.PageStyle.PageOrientation.Landscape(); //convert HTML file to RTF file int ret = objH.ConvertFile(@"..\..\..\..\..\..\Testing HTMLs\UTF-8 Sampler.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"); } } } }
Imports System Imports System.IO Imports System.Text Module Module1 Sub Main() 'Set page size and margins in RTF document '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"; 'Let's set page size A3, landscape orientation and all margins in 1 inch objH.PageStyle.PageSize.A3() objH.PageStyle.PageMarginTop.Inch(1.0F) objH.PageStyle.PageMarginRight.Inch(1.0F) objH.PageStyle.PageMarginBottom.Inch(1.0F) objH.PageStyle.PageMarginLeft.Inch(1.0F) objH.PageStyle.PageOrientation.Landscape() 'convert HTML file to RTF file Dim ret As Integer = objH.ConvertFile("..\..\..\..\..\Testing HTMLs\UTF-8 Sampler.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