Skip to content
Guides

Image Conversion

To convert a Image file to an Office or other format, send a request to /file/handle, including the Image file as input and file processing parameters. Before you begin, make sure ComPDFKit Processor is started and running.

You will send a POST request to the endpoint /file/handle of the processor. For more information about multipart requests, please refer to the API section.

Convert using local PDF file

Send segmented requests to /file/handle and attach the Image file:

shell
curl -f -X POST http://localhost:7000/file/handle \
-H "Content-Type: multipart/form-data" \
-F file=@"image.png" \
-F executeType="img/docx" \
-F password="file open password" \
-F parameter="{ \"contentOptions\": \"2\", \"worksheetOptions\": \"1\"}" \
> result.docx

Image Conversion Parameters

This section introduces the parameter settings for file processing supported by ComPDFKit Processor. Special parameter settings are available for Image to Word, Excel, PPT, HTML, RTF, TXT, and CSV formats. For other functionalities, parameter settings can be ignored (default parameters will be used for document processing).

Image to Word

Note: Special parameters can be used when uploading files for different functions, while the remaining steps remain consistent.

Image to Word:

java
{    
  "wordLayoutMode": "1",
  "isAllowOcr": "0",
  "isContainOcrBg": "0",
  "isOnlyAiTable": "0"
}

Required parameters

wordLayoutMode: Typesetting method (1. Flow layout mode; 2. Flow layout supports tables; 3. Box layout mode;) 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.

Image to Excel

Note: Different parameters can be used when uploading files for different functions. The rest of the steps remain the same.

Image to Excel:

java
{
    "contentOptions": "2",
    "worksheetOptions": "1",
    "isAllowOcr":"0",
    "isOnlyAiTable":"0"
}

Required parameters

contentOptions: Content extraction options (1: text only, 2: charts only, 3: all content).

worksheetOptions: Options for creating worksheets (1: ForEachTable, 2: ForEachPage, 3: ForTheDocument).

isAllowOcr: Whether to allow to open OCR (1: yes, 0: no), Default 0.

isOnlyAiTable: Whether to enable AI to recognize table (1: yes, 0: no) Default 0.

Image to PPT

Note: Different parameters can be used when uploading files for different functions. The rest of the steps remain the same.

Image to PPT:

java
{    
  "isAllowOcr": "0",
  "isContainOcrBg": "0",
  "isOnlyAiTable": "0"
}

Required parameters

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.

Image to HTML

Note: Different parameters can be used when uploading files for different functions. The rest of the steps remain the same.

Image to HTML:

java
{
   "pageOptions": "2",
   "isAllowOcr": "0",
   "isContainOcrBg": "0",
   "isOnlyAiTable": "0"
}

Required parameters

pageOptions: 1: SinglePage, 2: SinglePageNavigationByBookmarks, 3: MultiplePages, 4: MultiplePagesSplitByBookmarks

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.

Image to RTF

Note: Different parameters can be used when uploading files for each specific function. The other steps remain consistent.

Image to RTF:

java
{    
  "isAllowOcr": "0",
  "isContainOcrBg": "0"
}

Required parameters

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.

Image to CSV

Note: You can use specific parameters for each functionality when uploading files, while the other steps remain the same.

Image to CSV:

java
{    
  "isCsvMerge": "1",
  "isAllowOcr": "0",
  "isOnlyAiTable": "0"
}

Required parameters

isCsvMerge: Whether to merge CSV files (1: Yes, 0: No).

  • When isCsvMerge is set to 1, the returned file is in .csv format.
  • When isCsvMerge is set to 0, the returned file is in .zip format.

isAllowOcr : Whether to allow to open OCR (1: yes, 0: no) Default 0.

isOnlyAiTable:Whether to enable AI to recognize table (1: yes, 0: no) Default 0.

Image to TXT

Note: Different parameters can be used when uploading files for each specific function. The other steps remain consistent.

Image to TXT:

java
{    
  "isAllowOcr": "0",
  "isContainOcrBg": "0"
}

Required parameters

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.