The ExportToHTML5Ex method exports PDF documents to HTML5 format.
Public Function ExportToHTML5Ex(stream As Stream, option As IacHtml5ExportOptions, imageNamingInfo As String) As Boolean
Public Function ExportToHTML5Ex(stream As System.IO.Stream, Options As Amyuni.PDFCreator.acHtml5ExportOptions, imageNamingInfo As String, fromPage As Integer, toPage As Integer) As Boolean
public bool ExportToHTML5Ex(System.IO.Stream stream, Amyuni.PDFCreator.IacHtml5ExportOptions option, string imageNamingInfo)
public bool ExportToHTML5Ex(System.IO.Stream stream, Amyuni.PDFCreator.acHtmlExportOptions Options, string imageNamingInfo, int fromPage, int toPage)
stream
.Net stream object to which to send the HTML5 data
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)
fromPage
Starting page for export.
toPage
Ending page for export.
Returns True on success, False otherwise.
The exception Amyuni.PDFCreator.IacException.LicenseKeyError might be generated if the provided license is not valid or wrong.
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" />
Member of Amyuni.PDFCreator.IacDocument.
<Flags>
Public Enum OPTIMIZATION_LEVEL
NO_OPTIMIZATION = 0
LINE_OPTIMIZATION = 1
PARAGRAPH_OPTIMIZATION = 2
TABLE_OPTIMIZATION = 3
End Enum
Public Sub Sample()
' Constants for Activation codes
Const strLicenseTo As String = "Amyuni PDF Creator .NET Evaluation"
Const strActivationCode As String = "07EFCDAB0100010025C3B7B351579FF94C49112EAF7368612744C7237C2F6A215A53E83A9ECCFFE54C52063CB05338BDE555773D7B1B"
' Initialize library
' This should be done once
acPDFCreatorLib.Initialize()
' set license key This is needed only with licensed version
acPDFCreatorLib.SetLicenseKey(strLicenseTo, strActivationCode)
' Create new stream object
Dim fileRead As System.IO.Stream = System.IO.File.OpenRead("C:\temp\PDFDocument.pdf")
' Create a new PDF document
Dim doc As New Amyuni.PDFCreator.IacDocument()
' Open stream
Dim Password As String = ""
doc.Open(fileRead, Password)
' Recommended optimization to export the file
doc.OptimizeDocument(OPTIMIZATION_LEVEL.PARAGRAPH_OPTIMIZATION)
' Create new stream object
Dim fileWrite As System.IO.Stream = System.IO.File.OpenWrite("C:\temp\file.html")
' Export PDF
doc.ExportToHTML5Ex(fileWrite,
Amyuni.PDFCreator.IacHtml5ExportOptions.acHtml5ExportOptionIncludeHeader Or
Amyuni.PDFCreator.IacHtml5ExportOptions.acHtml5ExportOptionUTF8Encoding,
"img|c:\intepub\wwwroot\mywebsite\images|images")
' Close the stream
fileRead.Close()
fileWrite.Close()
' terminate library to free resources
acPDFCreatorLib.Terminate()
' destroy objects
doc.Dispose()
End Sub
public void Sample()
{
// Constants for Activation codes
const string strLicenseTo = "Amyuni PDF Creator .NET Evaluation";
const string strActivationCode = "07EFCDAB0100010025C3B7B351579FF94C49112EAF7368612744C7237C2F6A215A53E83A9ECCFFE54C52063CB05338BDE555773D7B1B";
// Initialize library
// This should be done once
acPDFCreatorLib.Initialize();
// set license key This is needed only with licensed version
acPDFCreatorLib.SetLicenseKey(strLicenseTo, strActivationCode);
// Create new stream object
System.IO.FileStream fileRead = new System.IO.FileStream(@"C:\temp\PDFDocument.pdf",
System.IO.FileMode.Open,
System.IO.FileAccess.Read,
System.IO.FileShare.Read);
// Create a new PDF document
Amyuni.PDFCreator.IacDocument doc = new Amyuni.PDFCreator.IacDocument();
// Open stream
String password = "";
doc.Open(fileRead, password);
// Recommended optimization to export the file
doc.OptimizeDocument((int)OPTIMIZATION_LEVEL.PARAGRAPH_OPTIMIZATION);
// Create new stream object
System.IO.FileStream fileWrite = new System.IO.FileStream(@"C:\temp\file.html",
System.IO.FileMode.Create,
System.IO.FileAccess.Write,
System.IO.FileShare.Read);
// Export PDF
doc.ExportToHTML5Ex(fileWrite,
Amyuni.PDFCreator.IacHtml5ExportOptions.acHtml5ExportOptionIncludeHeader |
Amyuni.PDFCreator.IacHtml5ExportOptions.acHtml5ExportOptionUTF8Encoding,
"img|c:\\intepub\\wwwroot\\mywebsite\\images|images");
// Close the stream
fileRead.Close();
fileWrite.Close();
// terminate library to free resources
acPDFCreatorLib.Terminate();
// destroy objects
doc.Dispose();
}