ExportToHTML5Ex Method

The ExportToHTML5Ex method exports a PDF document to HTML5 format, and adds some additional options.

 

Syntax

VB:

Sub ExportToHTML5Ex(stream As IStream, option As acHtml5ExportOptions, imageNamingInfo As String)

C#:

void ExportToHTML5Ex(IStream stream, acHtml5ExportOptions options, string imageNamingInfo)

C++:

HRESULT ExportToHTML5Ex(IStream * stream, acHtml5ExportOptions options, BSTR imageNamingInfo)

 

Parameters

stream

A COM object that implements the OLE interface IStream. This object will be used to write the html output.

options

 

Options

Value

Description

acHtml5ExportOptionIncludeHeader

1

Include HTML tags like <head> and <meta> in the output file

acHtml5ExportOptionEmbedImages

2

Embed raster images from the PDF file inside the output file instead of generating external files.

acHtml5ExportOptionUTF8Encoding

4

Use UTF8 encoding for the output file

acHtml5ExportOptionUTF16Encoding

8

Use UTF16 encoding for the output file

acHtml5ExportOptionDefault

7

Default settings (a combination of acHtml5ExportOptionIncludeHeader, acHtml5ExportOptionEmbedImages and acHtml5ExportOptionUTF8Encoding)

 

imageNamingInfo

A string that contains an image prefix, the images output folder, and a base url to be added inside the HTML page, all separated by ’|’ (refer to Remarks)

 

Remarks

The parameter imageNamingInfo consists of a string containing an image prefix, the images output folder, and then a base url, all separated by a "|". So basically if the user wants every image to be preceded by the prefix "img", the images output folder to be "c:\intepub\wwwroot\mywebsite\images" and the internal references to every image to have the base url "images", then the image naming info string should be set to "img|c:\intepub\wwwroot\mywebsite\images|images".
Output example: <img src="images/imgABCDE.jpg" width="200px" height="200px" />

 

This method uses the PageSequence or PageSecuenceStr attributes from Document Object to determine which pages are going to be exported.

 

Example

adTypeBinary = 1

 

' Create Stream object

Dim BinaryStream

Set BinaryStream = CreateObject("ADODB.Stream")

 

' Specify stream type - we want to save binary data.

BinaryStream.Type = adTypeBinary

 

' Open the stream and write the HTML output to it

BinaryStream.Open

With PDFCreactiveX1

    .Open "test.pdf", ""

 

    ' Set Optimization to paragraph level

    .OptimizeDocument 2

    .ExportToHTML5Ex BinaryStream, acHtml5ExportOptionIncludeHeader Or acHtml5ExportOptionUTF8Encoding, "img|c:\intepub\wwwroot\mywebsite\images|images"

End With