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 Searchable PDF API

Create a searchable/editable PDF by adding OCR text to the source PDF.

Feature

Request Mode

ItemValue
Authenticationx-api-key: your_api_key_here
Request URLPOST http://localhost:8080/api/v1/process/pdf/pdf
Content typemultipart/form-data
Success responsePDF 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.
formulaToImageInteger or StringWhether to render formulas as images. 0 keeps formulas as editable content where possible; 1 renders formulas as images.
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.
transparentTextInteger or StringSearchable/editable PDF option. Whether OCR text is transparent over the original page image.
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/pdf" \
  -H "x-api-key: your_api_key_here" \
  -F "[email protected]" \
  -F 'options={"isContainImg":1,"formulaToImage":0,"enableOcr":0,"ocrRecognitionLang":"AUTO","ocrOption":"ALL","transparentText":1,"pageRanges":"","isOutputDocumentPerPage":0}'

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.