Skip to content
ComPDF
New Release

Open-Source PDF SDK & AI Document Processing

Get the full self-hosted SDK and AI document processing on GitHub. One-click deploy to quickly build your document workflows.

PDF to RTF API

Convert a PDF file to RTF.

Feature

Request Mode

ItemValue
Authenticationx-api-key: your_api_key_here
Request URLPOST http://localhost:8080/api/v1/process/pdf/rtf
Content typemultipart/form-data
Success responseRTF file stream

Request Parameters

ParameterTypeDescriptionRequired
fileFileSource file. Recommended extension: .pdf.Yes
optionsStringJSON string containing the feature options below.No
passwordStringSource file open password, used for password-protected PDFs.No

Options Parameters

Put the following fields in the options JSON string.

ParameterTypePurpose
isContainImgInteger or StringWhether to include images in the output. 0 = no, 1 = yes.
isContainAnnotInteger or StringWhether to include annotations in the output. 0 = no, 1 = yes.
enableOcrInteger or StringWhether to use OCR. 0 = disabled, 1 = enabled.
ocrRecognitionLangStringOCR language code. Supported values: AUTO, CHINESE, CHINESE_TRAD, ENGLISH, KOREAN, JAPANESE, LATIN, DEVANAGARI, CYRILLIC, ARABIC, TAMIL, TELUGU, KANNADA, THAI, GREEK, ESLAV. Default: AUTO.
ocrOptionStringINVALID_CHARACTER, SCAN_PAGE, INVALID_CHARACTERAND_SCAN_PAGE, or ALL. Default: ALL.
pageRangesStringPage ranges to process, starting from page 1. Examples: 1, 1-3, 1,3-5. Empty means all pages.
isOutputDocumentPerPageInteger or StringWhether to output each page as a separate document. 0 = no, 1 = yes.
containPageBackgroundImageInteger or StringWhether to include page background images. Mainly used with OCR-enabled conversion.
outputFileNameStringOptional output filename. When present, it is used as the preferred download filename.

Request Example

bash
curl -X POST "http://localhost:8080/api/v1/process/pdf/rtf" \
  -H "x-api-key: your_api_key_here" \
  -F "[email protected]" \
  -F 'options={"isContainImg":1,"isContainAnnot":1,"enableOcr":0,"ocrRecognitionLang":"AUTO","ocrOption":"ALL","pageRanges":"","isOutputDocumentPerPage":0,"containPageBackgroundImage":1}'

Response

On success, the API returns the converted file stream with Content-Type and Content-Disposition headers. On failure, the ComPDF Self-hosted returns a normalized error JSON response.