---
title: "Convert a PDF into words with location"
method: POST
path: "/ocr/pdf/to/words-with-location"
tags: ["PdfOcr"]
---

# Convert a PDF into words with location

`POST /ocr/pdf/to/words-with-location`

Converts a PDF into words/text with location information and other metdata via Optical Character Recognition.  This API is intended to be run on scanned documents.  If you want to OCR photos (e.g. taken with a smart phone camera), be sure to use the photo/toText API instead, as it is designed to unskew the image first.

## Headers

- `language` string
- `preprocessing` string

## Response `200`

OK

- PdfToWordsWithLocationResult — Response from an OCR to words with location operation. Includes the confience rating and converted text result, along with the locations of the words in the pages.
  - `Successful` boolean — True if successful, false otherwise
  - `OcrPages` OcrPageResultWithWordsWithLocation[] — OCR page results
    - `PageNumber` integer — Page number of the page that was OCR-ed, starting with 1 for the first page in the PDF file
    - `Successful` boolean — True if successful, false otherwise
    - `Words` OcrWordElement[] — Word elements in the image
      - `WordText` string — Text of the word
      - `LineNumber` integer — Line number of the word
      - `WordNumber` integer — Index of the word in the line
      - `XLeft` integer — X location of the left edge of the word in pixels
      - `YTop` integer — Y location of the top edge of the word in pixels
      - `Width` integer — Width of the word in pixels
      - `Height` integer — Height of the word in pixels
      - `ConfidenceLevel` number, double — Confidence level of the machine learning result; possible values are 0.0 (lowest accuracy) - 1.0 (highest accuracy)
      - `BlockNumber` integer — Index of the containing block
      - `ParagraphNumber` integer — Index of the containing paragraph
      - `PageNumber` integer — Index of the containing page

---

[API](https://skmtc.net/cloudmersive/apis/ocrapi.md) · [All operations](https://skmtc.net/cloudmersive/apis/ocrapi/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/cloudmersive/ocrapi/revisions/809f1a173306/schema)
