Allows to specify various properties for HTML document: title, how to store images, inlince CSS and so forth.

Namespace:  SautinSoft
Assembly:  SautinSoft.PdfFocus (in SautinSoft.PdfFocus.dll) Version: 6.6.9.7 (6.6.9.7)

Syntax

      
 C#  Visual Basic 
public class CHtmlOptions
Public Class CHtmlOptions

Members

         
 All Members  Constructors   Properties  
 Public

 Protected
 Instance

 Static 
 Declared

 Inherited
 XNA Framework Only 

 .NET Compact Framework Only 

 MemberDescription
PdfFocus..::.CHtmlOptions()()()
Initializes a new instance of the PdfFocus..::.CHtmlOptions class
CombineImages
Sets or gets value to combine all images on page into a single image.
ImageFileName
Gets or sets a template name for images.
ImageFolder
Gets or sets a path to a directory to store images after converting. Notice also to the property "ImageSubFolder".
ImageNumStart
The starting number for naming images in the HTML document
ImageSubFolder
Gets or sets a folder name which will be created by the component to store images.
ImageType
Gets or sets the type to store all images for the current HTML document.
IncludeImageInHtml
Allows to specify how to store images: Inside HTML document as base64 images or as linked separate image files.
InlineCSS
Gets or sets a value to produce inline CSS or put all CSS styles will between <style>...</style> tags.
JpegQuality
Allows to specify the quality for output JPEG images from 1 to 100. Default: 90.
PreserveImages
Specifies whether to keep images within the HTML document or skip them.
ProduceOnlyHtmlBody
Gets or sets a value to produce a complete HTML document or only between between <body>...</body> tags.
ShowInvisibleText
Gets or sets a value to show invisible text or not.
SingleFontFamily
Sets or gets a single font family for a whole text in the HTML document.
SingleFontSize
Sets or gets a single font size in points (pt) for a whole text in the HTML document.
Title
Sets the title for the HTML document
UseNumericCharacterReference
True: Write the all characters in "NCR" notation: &#xxx;. False: Write the all characters as Unicode (recommended).
Default value: false.

Remarks

All properties are already set to their defaults:

JpegQuality = 90;
IncludeImageInHtml = false;
ImageFolder = String.Empty;
ImageSubFolder = "images";
ImageFileName = "image";
ImageNumStart = 1;
PreserveImages = true;
Title = "Untitled document";
ImageType = eHtmlImageType.Png;
SingleFontFamily = String.Empty;
SingleFontSize = null;
CombineImages = false;
InlineCSS = false;
ProduceOnlyHtmlBody = false;
ShowInvisibleText = false;

Examples

CopyHow to set a location of images during PDF to HTML in C#
using System;
using System.IO;
using SautinSoft;

namespace Sample
{
    class Sample
    {
        static void Main(string[] args)
        {
            // Here you will find various ways to store images
            string pdfFile = @"..\..\..\..\..\simple text.pdf";
            string htmlFile = Path.ChangeExtension(pdfFile, ".htm");

            // Convert PDF file to HTML file
            SautinSoft.PdfFocus f = new SautinSoft.PdfFocus();


            // Way 1: Images will be stored as physical PNG files in a special folder.
            // TheThe component will create this special folder.

            f.HtmlOptions.ImageFolder = Path.GetDirectoryName(pdfFile);
            f.HtmlOptions.ImageSubFolder = "special folder";            
            f.HtmlOptions.ImageType = PdfFocus.CHtmlOptions.eHtmlImageType.Png;            

            // Way 2: Images will be stored as PNG files in the same directory with HTML file.
            // All images on each page will be combined in a single image.
            f.HtmlOptions.ImageFolder = Path.GetDirectoryName(pdfFile);
            f.HtmlOptions.ImageType = PdfFocus.CHtmlOptions.eHtmlImageType.Png;
            f.HtmlOptions.ImageSubFolder = "";
            f.HtmlOptions.CombineImages = true;

            // Way 3: Images will be stored as Jpeg files in a special folder "my images".
            // Images will have name "picture100.jpg", "picture101.jpg" .. "pictureN.jpg".
            // Let's set the quality for jpeg images to 95 percents.
            f.HtmlOptions.ImageFolder = Path.GetDirectoryName(pdfFile);
            f.HtmlOptions.ImageType = PdfFocus.CHtmlOptions.eHtmlImageType.Jpeg;
            f.HtmlOptions.JpegQuality = 95;
            f.HtmlOptions.ImageSubFolder = "my images";
            f.HtmlOptions.ImageFileName = "picture";
            f.HtmlOptions.ImageNumStart = 100;
            f.HtmlOptions.CombineImages = false;

            // Way 4: Images will be stored inside HTML document as base64 images.
            f.HtmlOptions.IncludeImageInHtml = true;            

            f.OpenPdf(pdfFile);

            if (f.PageCount > 0)
            {
                int result = f.ToHtml(htmlFile);

                // Show resulted HTML document in a browser.
                if (result==0)
                {
                    System.Diagnostics.Process.Start(htmlFile);
                }
            }
        }
    }
}
CopyHow to set a location of images during PDF to HTML in VB.Net
Imports System.IO
Imports System.Drawing.Imaging
Imports System.Collections.Generic
Imports SautinSoft

Module Sample

    Sub Main()
        ' Here you will find various ways to store images
        Dim pdfFile As String = "..\..\..\..\simple text.pdf"
        Dim htmlFile As String = Path.ChangeExtension(pdfFile, ".htm")

        ' Convert PDF file to HTML file
        Dim f As New SautinSoft.PdfFocus()


        ' Way 1: Images will be stored as physical PNG files in a special folder.
        ' TheThe component will create this special folder.


        f.HtmlOptions.ImageFolder = Path.GetDirectoryName(pdfFile)
        f.HtmlOptions.ImageSubFolder = "special folder"
        f.HtmlOptions.ImageType = PdfFocus.CHtmlOptions.eHtmlImageType.Png

        ' Way 2: Images will be stored as PNG files in the same directory with HTML file.
        ' All images on each page will be combined in a single image.
        f.HtmlOptions.ImageFolder = Path.GetDirectoryName(pdfFile)
        f.HtmlOptions.ImageType = PdfFocus.CHtmlOptions.eHtmlImageType.Png
        f.HtmlOptions.ImageSubFolder = ""
        f.HtmlOptions.CombineImages = True

        ' Way 3: Images will be stored as Jpeg files in a special folder "my images".
        ' Images will have name "picture100.jpg", "picture101.jpg" .. "pictureN.jpg".
        ' Let's set the quality for jpeg images to 95 percents.
        f.HtmlOptions.ImageFolder = Path.GetDirectoryName(pdfFile)
        f.HtmlOptions.ImageType = PdfFocus.CHtmlOptions.eHtmlImageType.Jpeg
        f.HtmlOptions.JpegQuality = 95
        f.HtmlOptions.ImageSubFolder = "my images"
        f.HtmlOptions.ImageFileName = "picture"
        f.HtmlOptions.ImageNumStart = 100
        f.HtmlOptions.CombineImages = False

        ' Way 4: Images will be stored inside HTML document as base64 images.
        f.HtmlOptions.IncludeImageInHtml = True

        f.OpenPdf(pdfFile)

        If f.PageCount > 0 Then
            Dim result As Integer = f.ToHtml(htmlFile)

            ' Show resulted HTML document in a browser.
            If result = 0 Then
                System.Diagnostics.Process.Start(htmlFile)
            End If
        End If
    End Sub
End Module

Inheritance Hierarchy

System..::.Object
  SautinSoft..::.PdfFocus..::.CHtmlOptions

See Also