The ExportToHTMLEx method exports PDF document to HTML format.
Public Function ExportToHTMLEx (FileName As String, Options As acHtmlExportOptions, imageNamingInfo As String, downsamplingResolution As Long)
public System.Boolean ExportToHTMLEx (string FileName, acHtmlExportOptions Options, string imageNamingInfo, int downsamplingResolution)
FileName
Name of the file with .html extension to export to
Options
Option |
Value |
Description |
acHtmlExportOptionLayers |
1 |
Multiple pages in a single HTML file using layers |
acHtmlExportOptionSinglePage |
2 |
All pages in a single HTML file |
acHtmlExportOptionMultiplePages |
3 |
Each page in a separate HTML file |
acHtmlExportOptionVectorGraphics |
4 |
Accurately convert vector graphics. |
acHtmlExportOptionForceImagesToJpg |
8 |
Force all images to jpg |
acHtmlExportOptionForceImagesToPng |
16 |
Force all images to png |
imageNamingInfo
It contains the image folder name, then the background folder name, and then the image prefix, all separated by ’|’ (refer to Remarks)
downsamplingResolution
It specifies a resolution to which all images will be downsampled.
When set to 0, no downsampling is performed.
By default, ExportToHTML Method only uses html's very limited support for vector graphics and this renders disappointing conversions for documents which use a lot of vector graphics. In order to accurately convert pages full of graphics, it's very important to add the acHtmlExportOptionVectorGraphics flag. For example, to export a document accurately to a single html page the options should be set to:
Options = acHtmlExportOptionSinglePage | acHtmlExportOptionVectorGraphics
Failing to combine with the second option results in a weak conversion.
The ExportToHTMLEx method also allows the user to force all images to either JPEG or PNG:
acHtmlExportOptionForceImagesToJpg.
acHtmlExportOptionForceImagesToPng.
The parameter imageNamingInfo consists of a string containing the image folder name, then the background folder name and then the image prefix, all separated by a "|". So basically if the user wants the image directory to be called "images", the background folder named "bg" and wants every image to be preceded by the prefix "img" then the image naming info string should be set to "images|bg|img".
If the user wants all images to be placed in the same folder, then he/she must provide the same name for both the images and backgrounds folder.
|
We usually export images in the pdf file as independent images and store them in the "images" folders, whereas we output anything else that can’t be handled by the built in html support as a background image for the page. |
// Initialize Library
acPDFCreatorLib.Initialize();
// set license key
acPDFCreatorLib.SetLicenseKey("Evaluation", "07EFC00...77C23E29");
System.IO.FileStream file1 = new System.IO.FileStream("TestFile.pdf", FileMode.Open, FileAccess.Read);
pdfCreator1.Document.Open(file1, "");
pdfCreator1.Document.OptimizeDocument(1);
pdfCreator1.Document.ExportToHTMLEx("HTMLExportEx.html", IacHtmlExportOption.acHtmlExportOptionSinglePage | IacHtmlExportOption.acHtmlExportOptionForceImagesToJpg | IacHtmlExportOption.acHtmlExportOptionVectorGraphics, "images|backgrounds|pre", 72);