The ExportToHTMLEx method converts a PDF document to an HTML document.
This method needs special license. Please, contact our Sales Department for more information
System.Boolean ExportToHTML(System.String FileName, CDIntfEx.acHtmlExportOptions HtmlOption)
System.Boolean ExportToHTMLEx(System.String FileName, CDIntfEx.acHtmlExportOptions HtmlOption, System.String imageNamingInfo, System.Int32 downsamplingResolution)
FileName
Full path of resulting HTML file.
HtmlOption
Options |
Description |
Value |
---|---|---|
acHtmlExportOptionLayers |
Multiple pages in a single HTML file using layers. |
1 |
acHtmlExportOptionSinglePage |
All pages in a single HTML file. |
2 |
acHtmlExportOptionMultiplePages |
Each page in a separate HTML file. |
3 |
acHtmlExportOptionVectorGraphics |
Accurately convert vector graphics. |
4 |
acHtmlExportOptionForceImagesToJpg |
Force all images to Jpg. |
8 |
acHtmlExportOptionForceImagesToPng |
Force all images to Png. |
16 |
imageNamingInfo
It contains the image folder name, then the background folder name, and then the image prefix, all separated by "|".
downsamplingResolution
It specifies a resolution to which all images will be downsampled.
When set to 0, no downsampling is performed.
The return value is True if the document was converted, False otherwise.
It is recommended to use this method together with Optimize method.
By default, ExportToHTMLEx 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 jpg 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 "|". 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.
Member of CDIntfEx.Document.
<Flags()>
Public Enum OPTIMIZE As Integer
NO_OPTIMIZATION = 0
LINE_OPTIMIZATION = 1
PARAGRAPH_OPTIMIZATION = 2
TABLE_OPTIMIZATION = 3
End Enum
Private Sub Sample()
' Constants for Activation codes
Const strLicenseTo As String = "Amyuni PDF Converter Evaluation"
Const strActivationCode As String = "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA"
' Declare a new cdintfex document if it does not exist in the form.
Dim pdfDoc As New CDIntfEx.Document
' The SetLicenseKey method should be called after creating an object of type
' CDIntfEx.Document to activate the advanced methods that require the object
' activation code to work properly
pdfDoc.SetLicenseKey(strLicenseTo, strActivationCode)
' Open the document
pdfDoc.Open("c:\temp\test.pdf")
' Optimize the document in Paragraph level
pdfDoc.Optimize(OPTIMIZE.PARAGRAPH_OPTIMIZATION)
' Export to HTML, but the license needs to have that option
pdfDoc.ExportToHTMLEx("c:\temp\page.html", CDIntfEx.acHtmlExportOptions.acHtmlExportOptionSinglePage Or CDIntfEx.acHtmlExportOptions.acHtmlExportOptionForceImagesToJpg, "images|bg|img", 300)
End Sub
[Flags]
public enum OPTIMIZE
{
NO_OPTIMIZATION = 0,
LINE_OPTIMIZATION = 1,
PARAGRAPH_OPTIMIZATION = 2,
TABLE_OPTIMIZATION = 3
}
private void Sample()
{
// Constants for Activation codes
const string strLicenseTo = "Amyuni PDF Converter Evaluation";
const string strActivationCode = "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA";
// Declare a new cdintfex document if it does not exist in the form.
CDIntfEx.Document pdfDoc = new CDIntfEx.Document();
// The SetLicenseKey method should be called after creating an object of type
// CDIntfEx.Document to activate the advanced methods that require the object
// activation code to work properly
pdfDoc.SetLicenseKey(strLicenseTo, strActivationCode);
// Open the document
pdfDoc.Open("c:\\temp\\test.pdf");
// Optimize the document in Paragraph level
pdfDoc.Optimize((int)OPTIMIZE.PARAGRAPH_OPTIMIZATION);
// Export to HTML, but the license needs to have that option
pdfDoc.ExportToHTMLEx("c:\\temp\\page.html", CDIntfEx.acHtmlExportOptions.acHtmlExportOptionSinglePage | CDIntfEx.acHtmlExportOptions.acHtmlExportOptionForceImagesToJpg, "images|bg|img", 300);
}
package Example;
import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.Dispatch;
import com.jacob.com.Variant;
public class Sample {
public enum OPTIMIZE
{
NO_OPTIMIZATION (0),
LINE_OPTIMIZATION (1),
PARAGRAPH_OPTIMIZATION (2),
TABLE_OPTIMIZATION (3);
private int value;
private OPTIMIZE(int value)
{
this.value = value;
}
public Object value(){
return value;
}
}
public enum HTMLOPTION
{
HtmlExportOptionLayers (1),
HtmlExportOptionSinglePage (2),
HtmlExportOptionMultiplePages (3),
HtmlExportOptionVectorGraphics (4),
HtmlExportOptionForceImagesToJpg(8),
HtmlExportOptionForceImagesToPng (16);
private int value;
private HTMLOPTION(int value)
{
this.value = value;
}
public Object value(){
return value;
}
}
public static void main(String[] args)
{
// Constants for Activation codes
String strLicenseTo = "Amyuni PDF Converter Evaluation";
String strActivationCode = "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA";
// Declare a new cdintfex document if it does not exist in the form.
ActiveXComponent pdfDoc = new ActiveXComponent("CDIntfEx.Document.6.5");
// The SetLicenseKey method should be called after creating an object of type
// CDIntfEx.Document to activate the advanced methods that require the object
// activation code to work properly
Dispatch.call(pdfDoc, "SetLicenseKey", strLicenseTo, strActivationCode);
// Open the document
Dispatch.call(pdfDoc, "Open", "c:\\temp\\test.pdf");
// Optimize the document in Paragraph level
Dispatch.call(pdfDoc, "Optimize",OPTIMIZE.PARAGRAPH_OPTIMIZATION.value);
// Export to HTML, but the license needs to have that option
Dispatch.call(pdfDoc, "ExportToHTMLEx", "c:\\temp\\page.html", HTMLOPTION.HtmlExportOptionSinglePage.value | HTMLOPTION.HtmlExportOptionForceImagesToJpg.Value, "images|bg|img", 300);
// Destroy pdfDoc object
pdfDoc = null;
}
}
$OPTIMIZE = @{
NO_OPTIMIZATION = 0
LINE_OPTIMIZATION = 1
PARAGRAPH_OPTIMIZATION = 2
TABLE_OPTIMIZATION = 3
}
$HTMLOPTION = @{
HtmlExportOptionLayers = 1
HtmlExportOptionSinglePage = 2
HtmlExportOptionMultiplePages = 3
HtmlExportOptionVectorGraphics = 4
HtmlExportOptionForceImagesToJpg = 8
HtmlExportOptionForceImagesToPng = 16
}
# Constants for Activation codes
$strLicenseTo = "Amyuni PDF Converter Evaluation"
$strActivationCode = "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA"
#Declare a new cdintfex document if it does not exist in the form.
$pdfDoc = New-Object -ComObject CDIntfEx.Document.6.5
#The SetLicenseKey method should be called after creating an object of type
#CDIntfEx.Document to activate the advanced methods that require the object
#activation code to work properly
[System.__ComObject].InvokeMember('SetLicenseKey', [System.Reflection.BindingFlags]::InvokeMethod,$null,$pdfDoc, @($strLicenseTo, $strActivationCode))
#Open the document
[System.__ComObject].InvokeMember('Open', [System.Reflection.BindingFlags]::InvokeMethod,$null,$pdfDoc,"c:\temp\test.pdf")
#Optimize the document in Paragraph level
[System.__ComObject].InvokeMember('Optimize', [System.Reflection.BindingFlags]::InvokeMethod,$null,$pdfDoc, $OPTIMIZE::PARAGRAPH_OPTIMIZATION)
#Export to HTML, but the license needs to have that option
[System.__ComObject].InvokeMember('ExportToHTMLEx', [System.Reflection.BindingFlags]::InvokeMethod,$null,$pdfDoc,
@("c:\temp\page.html", $HTMLOPTION::HtmlExportOptionSinglePage -bOr $HTMLOPTION::HtmlExportOptionForceImagesToJpg, "images|bg|img", 300))
#Destroy pdfDoc object
$pdfDoc = $null
Const NO_OPTIMIZATION = 0
Const LINE_OPTIMIZATION = 1
Const PARAGRAPH_OPTIMIZATION = 2
Const TABLE_OPTIMIZATION = 3
Const acHtmlExportOptionLayers = 1
Const acHtmlExportOptionSinglePage = 2
Const acHtmlExportOptionMultiplePages = 3
Const acHtmlExportOptionVectorGraphics = 4
Const acHtmlExportOptionForceImagesToJpg = 8
Const acHtmlExportOptionForceImagesToPng = 16
' Constants for Activation codes
Const strLicenseTo = "Amyuni PDF Converter Evaluation"
Const strActivationCode = "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA"
' Declare a new cdintfex document if it does not exist in the form.
Dim pdfDoc
Set pdfDoc = CreateObject("CDIntfEx.Document.6.5")
' The SetLicenseKey method should be called after creating an object of type
' CDIntfEx.Document to activate the advanced methods that require the object
' activation code to work properly
pdfDoc.SetLicenseKey strLicenseTo, strActivationCode
' Open the document
pdfDoc.Open "c:\temp\test.pdf"
' Optimize the document in Paragraph level
pdfDoc.Optimize PARAGRAPH_OPTIMIZATION
' Export to HTML, but the license needs to have that option
pdfDoc.ExportToHTMLEx "c:\temp\page.html", acHtmlExportOptionSinglePage Or acHtmlExportOptionForceImagesToJpg, "images|bg|img", 300
' Destroy pdfDoc object
Set pdfDoc = Nothing