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

# Convert a PDF into text lines with location

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

Converts a PDF into lines/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

- PdfToLinesWithLocationResult — Response from an OCR to lines with location operation. Includes the confience rating and converted text result, along with the locations of the lines in the pages.
  - `Successful` boolean — True if successful, false otherwise
  - `OcrPages` OcrPageResultWithLinesWithLocation[] — OCR results for each page
    - `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
    - `Lines` OcrLineElement[] — Word elements in the image
      - `LineText` string — Text of the line
      - `Words` OcrWordElement[] — Word objects in the line
        - `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)
