Image To HTML
With the Image to HTML tool, you can convert your Image file into a HTML file. The following examples show how to upload a test Image file and convert it into a HTML file using Java languages.
java
// Create a client
CPDFClient client = new CPDFClient(publicKey,secretKey);
// Create a task
// Create an example of a Image to HTML task
CPDFCreateTaskResult result = client.createTask(CPDFConversionEnum.IMAGE_TO_HTML);
// Get a task id
String taskId = result.getTaskId();
// File handling parameter settings
CIMGToHtmlParameter fileParameter = new CIMGToHtmlParameter();
fileParameter.setIsAllowOcr(CIMGToHtmlParameter.IS_ALLOW_OCR);
// Upload files
client.uploadFile(new File("test.jpg"), taskId, fileParameter);
// Execute task
client.executeTask(taskId);
// Query TaskInfo
CPDFTaskInfoResult taskInfo = client.getTaskInfo(taskId);
Needed Parameters
pageOptions
: Options to create HTML page (1: create single-page HTML, 2: create single-page HTML with bookmarked navigation, 3: create multi-page HTML, 4: create multi-page HTML with bookmarked navigation) Default 1.
isAllowOcr
: Whether to allow to open OCR (1: yes, 0: no), Default 0.
isContainOcrBg
: Whether to keep the background image after OCR is enabled (1: yes, 0: no) Default 0.
isOnlyAiTable
: Whether to enable AI to recognize table (1: yes, 0: no) Default 0.
Result:
File Type | Description |
---|---|
.zip | The HTML folder after the transfer process is completed. |