Click or drag to resize

DocumentPaginator Class

Provides a functionality to paginate the document content.
Inheritance Hierarchy

Namespace:  SautinSoft.Document
Assembly:  SautinSoft.Document (in SautinSoft.Document.dll) Version: (
public sealed class DocumentPaginator

The DocumentPaginator type exposes the following members.

Public propertyPages
Gets the document pages.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Load DOCX a document and save all pages as images in C#
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using SautinSoft.Document;

namespace Example
    class Program
        static void Main(string[] args)
        /// <summary>
        /// Loads a document and saves all pages as images.
        /// </summary>
        /// <remarks>
        /// Details:
        /// </remarks>
        static void SaveToImage()
            string filePath = @"..\..\example.docx";
            DocumentCore dc = DocumentCore.Load(filePath);
            string folderPath = Path.GetFullPath(@"Result-files");

            DocumentPaginator dp =  dc.GetPaginator();

            for (int i = 0; i < dp.Pages.Count; i++)
                DocumentPage page = dp.Pages[i];
                // For example, set DPI: 72, Background: White.
                Bitmap image = page.Rasterize(72, SautinSoft.Document.Color.White);
                image.Save(folderPath+@"\Page - "+i.ToString()+".png", ImageFormat.Png);
            System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(folderPath) { UseShellExecute = true });
Load DOCX a document and save all pages as images in VB.Net
Imports System
Imports System.IO
Imports SautinSoft.Document
Imports System.Drawing
Imports System.Drawing.Imaging

Module Sample
    Sub Main()
    End Sub

    ''' <summary>
    ''' Loads a document and saves all pages as images.
    ''' </summary>
    ''' <remarks>
    ''' Details:
    ''' </remarks>
    Sub SaveToImage()
        Dim filePath As String = "..\example.docx"
        Dim dc As DocumentCore = DocumentCore.Load(filePath)
        Dim folderPath As String = Path.GetFullPath("Result-files")

        Dim dp As DocumentPaginator = dc.GetPaginator()

        For i As Integer = 0 To dp.Pages.Count - 1
            Dim page As DocumentPage = dp.Pages(i)
            ' For example, set DPI: 72, Background: White.
            Dim image As Bitmap = page.Rasterize(72, SautinSoft.Document.Color.White)
            image.Save(folderPath & "\Page - " & i.ToString() & ".png", ImageFormat.Png)
        Next i
        System.Diagnostics.Process.Start(New System.Diagnostics.ProcessStartInfo(folderPath) With {.UseShellExecute = True})
    End Sub
End Module
See Also