Image |
The ImageSaveOptions type exposes the following members.
Name | Description | |
---|---|---|
![]() | ImageSaveOptions | Initializes a new instance of the ImageSaveOptions class. |
Name | Description | |
---|---|---|
![]() | ContentType |
Gets the content-type for image file format: application/image.
(Overrides SaveOptionsContentType) |
![]() | DpiX | Gets or sets the horizontal dots per inch (dpi) of the image. Default value is NaN, which means that component specific default value will be used (currently 300). |
![]() | DpiY | Gets or sets the vertical dots per inch (dpi) of the image. Default value is NaN, which means that component specific default value will be used (currently 300). |
![]() | Format | Gets or sets the image format. |
![]() | GifDelay | Gets or sets the delay in milliseconds between frames in the animated GIF. Default value: 33. (33 ms ~ 30fps, 16 ms ~ 60fps). |
![]() | PageCount | Gets or sets the number of pages to save. Default value: 1. |
![]() | PageIndex | Gets or sets the 0-based index of the first page to save. Default is 0. |
![]() | PixelFormat | Gets or sets a pixel format, which will be used for the image. |
![]() | SelectedPages | Gets or sets a custom page 0-based index set for save. Setting PageIndex or PageCount properties are overrides SelectedPages. |
![]() | TiffCompression | Gets or sets compression schema, which will be used when exporting to Tagged Image File Format (TIFF). |
See Developer Guide: Loads a document and saves all pages as images.
using System; using System.IO; using System.Runtime; using SautinSoft.Document; using SkiaSharp; namespace Example { class Program { static void Main(string[] args) { // Get your free trial key here: // https://sautinsoft.com/start-for-free/ SaveToImage(); } /// <summary> /// Loads a document and saves all pages as images. /// </summary> /// <remarks> /// Details: https://sautinsoft.com/products/document/help/net/developer-guide/save-document-as-image-net-csharp-vb.php /// </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. // To get high-quality image, lets set 72 dpi. var DPI = new ImageSaveOptions(); DPI.DpiX = 72; DPI.DpiY = 72; // Convert the page into PNG image. Directory.CreateDirectory(folderPath); page.Save(folderPath + @"\Page - " + i.ToString() + ".png", DPI); } System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(folderPath) { UseShellExecute = true }); } } }
Imports System Imports System.IO Imports System.Runtime Imports SautinSoft.Document Imports SkiaSharp Module Sample Sub Main() SaveToImage() End Sub ''' Get your free trial key here: ''' https://sautinsoft.com/start-for-free/ ''' <summary> ''' Loads a document and saves all pages as images. ''' </summary> ''' <remarks> ''' Details: https://sautinsoft.com/products/document/help/net/developer-guide/save-document-as-image-net-csharp-vb.php ''' </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 dpi As ImageSaveOptions = New ImageSaveOptions() dpi.DpiX = 72 dpi.DpiY = 72 Directory.CreateDirectory(folderPath) page.Save(folderPath + "\Page - " + i.ToString() + ".png", dpi) Next i System.Diagnostics.Process.Start(New System.Diagnostics.ProcessStartInfo(folderPath) With {.UseShellExecute = True}) End Sub End Module