PDF to RTF Tool Guide
Note:Before learning how to use different functions, we recommend that read the Request Workflow to know a basic PDF processing process. When using different functions, you can set their own special parameters when uploading files. Other basic steps are consistent.
PDF to RTF:
{
"enableAiLayout": 1,
"isContainImg": 1,
"isContainAnnot": 1,
"enableOcr": 0,
"ocrLanguage": 8,
"pageRanges": "1,2,3-5"
}
Required parameters
enableAiLayout
: Whether to enable AI layout analysis (0: not enabled; 1: enabled). Default 1.
isContainImg
: Whether to include images during conversion (0: not enabled; 1: enabled). Default 1.
isContainAnnot
: Whether to include annotations during conversion (0: not enabled; 1: enabled). Default 1.
enableOcr
: Whether to use OCR (0: Disable; 1: Enable). Default is 0.
ocrLanguage
: OCR recognition language. 1: CHINESE; 2: CHINESE_TRA; 3: ENGLISH; 4: KOREAN; 5: JAPANESE; 6: LATIN; 7: DEVANAGARI; 8: AUTO. Default is 8.
pageRanges
: Specify page number conversion, starting from 1. Default is empty.
Java Example:
Replace apiKey with the publicKey obtained from the dashboard, file with the file you want to convert, and language with your preferred interface error prompt language type.
import java.io.*;
import okhttp3.*;
public class main {
public static void main(String []args) throws IOException{
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM)
.addFormDataPart("file","{{file}}",
RequestBody.create(MediaType.parse("application/octet-stream"),
new File("<file>")))
.addFormDataPart("language","{{language}}")
.addFormDataPart("password","")
.addFormDataPart("parameter","{ \"isContainAnnot\": 1 , \"isContainImg\": 1}")
.build();
Request request = new Request.Builder()
.url("https://api-server.compdf.com/server/v1/process/pdf/rtf")
.method("POST", body)
.addHeader("x-api-key", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
}
}
Result:
File Type | Description |
---|---|
.rtf | The RTF file after the transfer process is completed |