OCR API for images and PDFs
Dreep's OCR turns an uploaded image or PDF into plain text. Append .txt to the asset's URL, or POST a file to /ocr. You are billed per page for the first extraction, and the result is cached so repeat reads are not billed again.
How extraction works
OCR sits in the same delivery pipeline as image and video transformations, so folder access rules and signed URLs apply to text as well.
- 1
Image or PDF asset
Uploaded to Dreep
- 2
Request .txt
Or ?format=txt
- 3
First request
Text extracted, one page billed
- 4
Cached text
Stored with your files
- 5
Later requests
Served from storage, not billed
Extract text in a few lines
// Upload and extract
const { text } = await dreep.extractText({
file: fs.createReadStream("receipt.jpg"),
});
// Text for an asset that is already stored
const textUrl = dreep.url(asset, { format: "txt" });// Upload and extract
result, err := client.UploadAndExtractText(ctx, f, "receipt.jpg", nil)
fmt.Println(result.Text)
// Text for an asset that is already stored
text, err := client.ExtractText(ctx, assetID, nil)# Upload and extract
curl -X POST "https://api.dreep.cloud/api/v1/ocr" \
-H "Authorization: Bearer drp_live_xxxxx" \
-F "file=@receipt.jpg"
# Text for an asset that is already stored
curl "https://cdn.dreep.cloud/api/v1/fetch/<assetId>.txt"Why use Dreep for OCR
No extra upload path
The file is already stored in Dreep, so there is no second upload and no second set of credentials.
Caching is handled
The first .txt request stores the text, and later requests read the stored result without another charge.
Access rules carry over
A receipt in a Signed folder produces text that also needs a signed URL.
Frequently asked questions
How is OCR billed?
Per page. The first extraction of a document uses one OCR page. The result is cached in storage, so fetching the same .txt URL again is not billed. Extra capacity is $4.99 per 1,000 pages.
Which file types can I extract text from?
JPEG and PNG images, and PDFs. On-the-fly extraction from a PDF reads a single-page document or the first page of a multi-page one.
Can I get the position of each line or word?
Yes. POST the file to /ocr with includeBlocks=true. Each line and word block has a bounding box with Top, Left, Width and Height as ratios between 0 and 1.
Does OCR work on files in private or signed folders?
Yes. Folder access rules apply to the .txt URL, so for a signed folder you request it with a signed URL generated by the SDK.
Read the text from your first receipt
Create a free project, upload an image or PDF and open its .txt URL.