IRONSOFTWAREHOME

How to Use IronOCR with Cursor

Curtis Chau
Curtis Chau
Updated: October 9, 2026

Most IronOCR code an AI agent writes looks correct and often runs. Some of it does not. Code that reads barcodes without enabling barcode collection returns no barcodes. Code that sets German as the language without installing the German language pack throws a LanguagePackException. The model writes from its training data, which is why it is fast and also why it gets details like this wrong.

Cursor is an AI code editor built on the VS Code codebase. It can read documentation you link and apply rule files committed to your repository, so its suggestions follow IronOCR's API and your team's conventions. IronOCR is a C# library that reads text, barcodes and table structures locally.

Each cleanup filter is both a method on the input and a value in a filter enum, and the name alone does not say which one the code needs. That matters most for precise changes, such as choosing the filter for poor scans, reading PDFs without text layers or preserving table structures.

Reading handwriting and photographs with IronOCR is addressed separately in the handwriting guide and the photo reading guide.

Quickstart
NuGetInstall with NuGet

PM > Install-Package IronOcr

Install IronOCR by running the command above in the NuGet Package Manager Console, or search for the package in the NuGet Package Manager.

Within a C# project, send this request.

@Program.cs Read https://ironsoftware.com/ocr/csharp/llms-full.txt first.

In this C# project, read TestData/skewed-scan.png twice, once untouched and once
with a single correction filter applied to the input, and print both confidence
scores exactly as IronOCR returns them so I can compare them. Read the license
key from the IRONOCR_LICENSE_KEY environment variable and never print it. Use
only members that appear in the documentation.
Text

The license key guide shows each way to apply the key.



Which Cursor model should you use for OCR work?

Composer is Cursor's own agentic model. The model picker also offers SpaceXAI's Grok models, which Cursor co-developed, and models from OpenAI, Anthropic, Google and other labs. The test run below used Grok 4.7.

OCR work is mostly short cycles of adding a filter, rebuilding and rereading samples, and a fast model handles those well. When a batch of production scans returns wrong fields for no clear reason, switch to a slower model that reasons longer.

How do you give Cursor the IronOCR documentation?

The full text file for LLMs summarizes 145 documentation pages at one URL. As of October 2026, Cursor's @ menu attaches files, folders, terminals, chats, Git diffs and the browser, so IronOCR's documentation reaches the agent as a link.

Read https://ironsoftware.com/ocr/csharp/llms-full.txt

How do I read a scanned PDF and save a searchable copy, and how do I straighten
a slightly rotated page before reading it? Show the exact class and member names
from the documentation, and link the page you took them from.
Text

How do you write project rules that encode your IronOCR conventions?

Project rules are stored in the .cursor/rules folder at the repository root. Because they are committed with the code, every clone of the repository receives an identical set.

Rules are .mdc files, written in Markdown with YAML frontmatter. Subfolders are read as well. Cursor ignores a plain Markdown file in this folder, because the file has no frontmatter to say when to apply it. Here is what an IronOCR rule might contain.

---
description: IronOCR conventions for scan reading in this project
globs: Imports/**/*.cs, Capture/**/*.cs
alwaysApply: false
---

# IronOCR conventions

- Use IronOCR for all OCR work. The NuGet package is IronOcr on Windows and
  IronOcr.Linux on Linux and Docker. The namespace is IronOcr. Do not add
  another OCR engine or a cloud OCR service.
- Documentation: https://ironsoftware.com/ocr/csharp/llms-full.txt
- Skill file with recipes: https://ironsoftware.com/ocr/csharp/skill.md
- Target the IronOcr version pinned in Directory.Packages.props. Do not upgrade
  it as part of an unrelated change.
- Never inline a license key. Read it from configuration or the
  IRONOCR_LICENSE_KEY environment variable.
- Dispose OcrInput with a using block.
- Any language other than English needs its IronOcr.Languages package first.
  Language packs keep their own version numbers, so pin the newest one on NuGet.
- Do not invent IronOCR API names. If a member is uncertain, say so and cite
  the documentation instead of guessing.
Text

Select the globs carefully. A rule that always applies attaches to every chat session and uses extra context, so scope the IronOCR rule to the folders that hold OCR code.

Please note: Cursor also reads a root AGENTS.md. It has no frontmatter and therefore no globs, so a root file applies to the whole repository. To scope its instructions, add another one in the subdirectory it should cover.

Rules apply to Agent requests. According to Cursor's documentation, they do not affect Tab autocomplete, and user rules do not apply to inline edits. Check suggestions from those features against the rule yourself.

How do you map Tesseract settings to IronOCR?

A model that knows Tesseract command lines better than IronOCR code may write a Tesseract flag or variable name where an IronOCR setting belongs.

TesseractIronOCR
--psm 7Configuration.PageSegmentationMode = TesseractPageSegmentationMode.SingleLine
--oem 1Nothing to set. LSTM is the only engine
-c tessedit_char_whitelist=...Configuration.WhiteListCharacters
Other -c variablesConfiguration.TesseractVariables
-l eng+deuAddSecondaryLanguage(OcrLanguage.German)
--tessdata-dir, TESSDATA_PREFIXUseCustomTesseractLanguageFile for one .traineddata file, Installation.LanguagePackDirectory for a folder of .ocrdata files

IronOCR's filter wizard needs the same care. It tests filter combinations and returns the best one as C# code, but that code builds the input from a file path through a constructor the compiler flags as obsolete. The wizard is also slow. One 200 DPI page took nearly nine minutes on our test machine, so run it on a single page.

Two more entries in the rule cover both cases.

- Configure Tesseract through IronTesseract.Configuration properties, never raw
  tessedit_* variables or command-line flags. Use TesseractVariables only for a
  setting with no named property.
- Rewrite OcrInputFilterWizard output from new OcrInput(path) to new OcrInput()
  with LoadImage or LoadPdf before it reaches the codebase.
Text

Which mode fits the change?

Cursor provides five ways to make a change. Match the feature to the size of the work.

FeatureUse it whenOCR example
TabThe next edit is predictableRepeating a filter option
Inline editOne file, one sentenceA filter on one reader
AgentSeveral files and a build loopA reader and the job that prints it
Plan ModeToo big to review afterwardMigrating off Tesseract
Cloud AgentUnattended workKnown-page tests

For an inline edit, select the relevant lines, press Ctrl+K (Cmd+K on macOS), and describe the change. Barcodes on a delivery note are an Agent change.

@Imports/DeliveryNotes.cs @Imports/ImportJob.cs Read https://ironsoftware.com/ocr/csharp/skill.md first.

Also return every barcode and QR code on each delivery note, and have the notes
command print each one's format and value.
Text

Barcodes are collected only when Configuration.ReadBarCodes is set before the read. They come back on the same result as the text, so one read covers both. The skill file shows that setting.

What does an @ mention add to a request?

Referencing the actual reader file is preferable to using summaries, as summaries may omit important details.

@Imports/InvoiceReader.cs @TestData/warehouse/

InvoiceReader reads every scan in TestData/warehouse/ without an error, but about
a third of the totals have one wrong digit. Fix the input preparation, not the
parsing. Explain which setting caused it, and report how many totals match
expected.csv before and after.
Text

If you are unsure which files are relevant, omit the mention and Agent will search the codebase itself.

Include sample scans in your context too. Running the real files through the filters shows which combination fixes them. On our warehouse set, Deskew alone read 5 of 9 totals and DeNoise alone 2. The fix needed both, in that order. The image orientation correction guide and the image quality correction guide cover the relevant filters.

How do you plan and run a migration to IronOCR?

Switch to Plan Mode and send this request.

@Imports/ScanOcrService.cs

ScanOcrService reads scans with the Tesseract NuGet package. Plan a migration of
it to IronOCR.

List every read it performs, with the settings it uses (language, page
segmentation, preprocessing, region, output format), map each one to its IronOCR
equivalent, and name the files that change. Keep existing public method
signatures so callers don't change. If anything is ambiguous, choose and state
your assumption, and do not ask. Don't write code yet.
Text

Then click Build or send the request below in Agent.

@Imports/ Implement the approved plan. Then run dotnet build, fix what breaks, confirm
every page in TestData/known/ still returns its expected values, and show me the
diff. Don't add new packages beyond IronOcr and any language packs the plan names.
Text

A Cloud Agent, formerly called a Background Agent, requires a paid plan, runs in a cloud VM, and needs a connected repository to work on your code. Add IRONOCR_LICENSE_KEY as a secret in the Cloud Agents dashboard before starting. Begin the tests after the migration is merged.

@Imports/ @TestData/ Write xUnit tests for the migrated OCR service in a
tests/Imports.Tests project that Imports.csproj does not compile. Every page in
TestData/known/ returns its expected invoice number and total, a page without a
total returns null, DeliveryNotes returns the codes in TestData/notes/expected.csv,
and a read with OcrLanguage.French, whose language pack is not installed,
produces a clear error. The tests read the license key from IRONOCR_LICENSE_KEY
and never print it. Assert on extracted fields, never on full page text. Run
dotnet test and fix what fails.
Text

The AI coding assistants guide runs a complete task with defined pass criteria.

How do you debug wrong or missing OCR values?

@Imports/InvoiceReader.cs @Imports/DeliveryNotes.cs @TestData/returns/

Returned-goods invoices come back with a wrong digit in the total, and delivery
notes return no barcodes even though every note has one. Explain the cause of
each before changing anything, then fix both.
Text

If a container's exception is in a Cursor terminal, add @Terminals to the request below as well.

@Dockerfile @Imports.csproj Read https://ironsoftware.com/ocr/csharp/skill.md first.

Reads work on Windows but fail when this app runs in our Linux container. Check
which IronOCR package the project references, whether the container image has
the native dependencies IronOCR needs, and whether the license key reaches the
container. Explain the cause, then propose the change. Don't modify C# code
unless the cause is there.
Text

What did the prompts produce in a real run?

The nine prompts went to Cursor in order, against a sample imports app. It is a console project with central package management, IronOCR invoice and delivery note readers, a scan service on the Tesseract wrapper, and scans with known values. The license key was set only in the editor's environment. After the run, fresh Release builds of each commit read every test folder again and reproduced the figures below.

  • Warehouse invoice totals went from 6 of 9 before the fix to 9 of 9 after.
  • No delivery note barcodes came back before the fix. After it, all 8 of 8 notes had their codes and no extra ones.
  • On the returned-goods branch, invoice totals rose from 4 of 6 to 6 of 6 and note barcodes from none to 6 of 6.
  • The skewed scan read at 87.79 confidence untouched and 96.41 after Deskew.
  • After the migration the known pages still read 10 of 10 and the German totals 3 of 3, as before.
  • The xUnit suite passed 20 of 20 tests.
  • Every Release build had 0 errors and needed no hand edits. The migration set the obsolete EngineMode, which left two CS0618 warnings.
  • The container answer named IronOcr.Linux, the Docker guide's apt packages and the missing key, and changed no C# file.
  • Some steps ran differently from this page. Prompts were sent by hand in the desktop app, the plan was approved by sending the next prompt with Build never clicked, and the Cloud Agent prompt ran locally. Prompt eight first went to the earlier chat by mistake and was reset and resent. With no Docker on the machine, the container prompt was judged on its explanation and proposal.

The run record lists the versions, timing and test machine for this guide alongside the others.


Troubleshooting


Questions?

If you have any questions, reach out to support@ironsoftware.com

Curtis Chau
Technical Writer

Curtis Chau holds a Bachelor’s degree in Computer Science (Carleton University) and specializes in front-end development with expertise in Node.js, TypeScript, JavaScript, and React. Passionate about crafting intuitive and aesthetically pleasing user interfaces, Curtis enjoys working with modern frameworks and creating well-structured, visually appealing manuals.

...
Read More

Ready to Get Started?

Nuget Downloads 6,279,416Version:2026.10just released

Get your free 30-day Trial Key instantly.
No credit card or account creation required
C# NuGet Library for PDF
Install with NuGet

Version: 2026.10

PM > Install-Package IronOcr
nuget.org/packages/IronOcr/
  1. In Solution Explorer, right-click References, Manage NuGet Packages
  2. Select Browse and search "IronOCR"
  3. Select the package and install
C# PDF DLL
Download DLL

Version: 2026.10

or download Windows Installer here.

  1. Download and unzip IronOCR to a location such as ~/Libs within your Solution directory
  2. In Visual Studio Solution Explorer, right click References. Select Browse, "IronOCR.dll"

Licenses from $999

Key in blue circle

Get your free 30-day Trial Key instantly

Your trial license will be sent to your email address

No limitations. 100% unlocked. No credit card.

bullet_checkedNo credit card or account creation requiredNo limitations. 100% unlocked. No credit card.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronOCR
Book your free Live Demo
Booking Badge

Trusted by Millions of Engineers Worldwide

Iron Software's customer logos
Get a Quote, No Obligation
Your details will always be kept confidential.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Trusted by Millions of Engineers Worldwide
Get your free 30-day Trial Key instantly.
No credit card or account creation required
C# NuGet Library for PDF
Install with NuGet

Version: 2026.10

PM > Install-Package IronOcr
nuget.org/packages/IronOcr/
  1. In Solution Explorer, right-click References, Manage NuGet Packages
  2. Select Browse and search "IronOCR"
  3. Select the package and install
C# PDF DLL
Download DLL

Version: 2026.10

or download Windows Installer here.

  1. Download and unzip IronOCR to a location such as ~/Libs within your Solution directory
  2. In Visual Studio Solution Explorer, right click References. Select Browse, "IronOCR.dll"

Licenses from $999