# How to Use IronOCR with Google Antigravity
Many AI coding tools stop at code compilation and leave you to verify that the code works. In OCR, this gap can be costly. For example, an invoice importer may build and populate a database without errors, yet a quarter of the totals may contain misread digits, which the build output will not reveal.
Google Antigravity operates through agents that return work for your review. IronOCR extracts text, barcodes, and tables from images and PDFs locally in .NET. When the agent manages test pages, it knows their contents, reads each page with IronOCR, compares extracted values to known values, and iterates until they match.
This article covers AI coding tools that help you build software on IronOCR. IronOCR's own machine learning features for photographs and handwriting are a separate subject, with their own [photo reading guide](https://ironsoftware.com/ocr/csharp/how-to/read-photo/) and [handwriting guide](https://ironsoftware.com/ocr/csharp/how-to/read-handwritten-image/).
*as-heading:2(Quickstart)*
!!!--LIBRARY_NUGET_INSTALL_BLOCK--!!!
Open your project in Antigravity and specify the expected output.
```text
/plan In this C# project, add IronOCR (the IronOcr NuGet package, namespace
IronOcr) and read the German invoice at TestData/rechnung.png, printing its text
and overall confidence. Only English ships with the package, so add whatever
German needs and tell me which package that was. Read the license key from the
IRONOCR_LICENSE_KEY environment variable, never hardcode it. Run dotnet build,
fix any errors, and show me the output.
```
The plan should name `IronOcr.Languages.German` and the language assignment, and omitting either is an error. Without the language pack, the first read throws a LanguagePackException, so the mistake shows up at once.
The [license key guide](https://ironsoftware.com/ocr/csharp/get-started/license-keys/) details all locations IronOCR checks for a key.
<div class="hsg-featured-snippet">
<h3>Minimal Workflow (5 steps)</h3>
<ol>
<li><a class="js-modal-open" data-modal-id="trial-license-after-download" href="https://www.nuget.org/packages/IronOcr/">Download the C# OCR library from NuGet</a></li>
<li>Check that the project compiles before you hand it to an agent</li>
<li>Reference the platform package that matches the host and load the key from settings</li>
<li>Give each task the pages, the language, the fields, and the values they should yield</li>
<li>Review the Implementation Plan, the diff, and the Walkthrough it hands back</li>
</ol>
</div>
<br class="clear" />
---
## What is Google Antigravity, and how is it different from a chat tool?
Given a goal, an Antigravity agent produces a plan, carries it out in the editor, the terminal, and a browser, and reports what it did in Artifacts you can review rather than a chat transcript.
Without guidance, an agent building a capture pipeline may pick the first OCR approach it finds or guess a package name. A guessed name can resolve to a counterfeit that an attacker published under that name in advance, a practice known as *slopsquatting*. Use `IronOcr` for Windows and `IronOcr.Linux` for Linux.
The [AI coding assistants guide](https://ironsoftware.com/ocr/csharp/ai-agents/ai/) lists the IronOCR documentation links to give the agent and includes a single-prompt acceptance test you can run in Antigravity.
## What does the agent hand back, and how do you review it?
### Before the code, the Implementation Plan
The plan defines the files, language selection, filters, and target fields. Review it to confirm the scope.
### During the run, the code diff
The code diff shows how the plan is implemented. Verify that the reader loads the specified pages, that promised filters are applied, and that every member used is present in the [API reference](https://ironsoftware.com/ocr/csharp/object-reference/api/).
### After the run, the Walkthrough
The Walkthrough concludes the task by summarizing changes and providing evidence of results.
## Where does the proof come from?
```text
/browser Services/CaptureService.cs extracts delivery note numbers and totals
from uploads to POST /capture.
1. Run the API and upload TestData/known/invoice-01.png in the browser.
Capture a screenshot.
2. Upload every file in TestData/known/ and record the delivery note number
and total returned.
3. Include the five rotated or noisy scans in that folder.
4. Report a table of file, expected delivery note number, number returned,
expected total, total returned, confidence, and match.
5. If any row does not match, explain the cause before changing anything, fix
it in CaptureService.cs, and run the whole table again. Attach the table
and the screenshots as Artifacts.
```
Repeating the entire table afterward confirms that a filter added for one scan has not broken others.
From the CLI, the `/browser` command started a Chrome subagent.
[[i:(Review the screenshot and any browser recording generated by Antigravity. If the agent skipped the upload form, it did not test the user workflow.)]]
To flag a misread, such as a total with a transposed digit, comment on the screenshot.
## What causes wrong or missing OCR values?
Most mismatches have a few common causes. Name the suspected cause and the agent skips the trial and error.
- Wrong digits on rotated or noisy pages usually call for `Deskew` and `DeNoise`.
- A read that returns text but no barcodes needs `Configuration.ReadBarCodes` turned on.
- When `ConvertToSearchablePdf` throws on a scan, call `SaveAsSearchablePdf` on the read result instead.
## How do you set up a project Antigravity can work in?
Provide the agent with a project that compiles. Otherwise, the agent spends its time on build errors.
Delegate installation to the agent.
```text
Add the IronOcr NuGet package to this project. Then tell me which version was
installed and show me the PackageReference line. Configure the license key to
be read from the IRONOCR_LICENSE_KEY environment variable or a config file
rather than hardcoded, and add that config file to .gitignore if it isn't
already. Don't change other package references.
```
Use the reported version number in all subsequent tasks.
Add a standing instructions file, `AGENTS.md` or `GEMINI.md`, to the repository root early in the project. Record that OCR uses IronOCR.
```text
/learn The repository already carries an AGENTS.md from the ChatGPT Codex
setup, and this platform reads the same file. Extend its OCR section with the
rules this platform adds. Produce an Implementation Plan before any file is
edited. Attach the evidence to the Walkthrough rather than describing it. And
treat no task as finished until every page read is checked against a known
value.
```
In our run, the agent added the three rules to the existing instructions file.
## How do you delegate extraction and migration work?
When you require field extraction, specify the relevant pages and the files the reader belongs in.
```text
Show me the Implementation Plan before any file is written. Then create
Services/DeliveryNoteReader.cs with a method that takes the path of a scanned
PDF, reads it with IronTesseract, and returns the amount on the line
containing Total due with that line's confidence, or null if the line is
missing. Create Services/SearchablePdf.cs with a method that writes a
searchable copy of a scanned PDF. Build, then prove ten sample invoices return
their known totals.
```
In our test, the reader loaded each scan as a PDF input and searched every page's lines for the Total due line.
Migrations are well-suited for delegation, as they are lengthy, repetitive, and prone to overlooked edge cases. Point the agent at the current source code.
```text
/plan Read Capture/LegacyCaptureService.cs. It reads scans with another OCR
library.
1. List every read it performs, with the settings it uses.
2. Map each setting to its IronOCR equivalent, citing the documentation page.
3. Produce this as a plan Artifact. Do not write code yet.
```
The desktop app holds the plan for your review. From the CLI, review the diff after a plan task.
Any mapping without a supporting link should be reviewed more closely. The [image input guide](https://ironsoftware.com/ocr/csharp/how-to/input-images/) and [PDF input guide](https://ironsoftware.com/ocr/csharp/how-to/input-pdfs/) address loading, while the [results guide](https://ironsoftware.com/ocr/csharp/how-to/read-results/) explains the output.
## When should you dispatch more than one agent?
OCR migrations can be divided into two parallel tasks.
```text
Agent A: migrate Capture/LegacyCaptureService.cs to IronOCR per the approved
plan. Keep the public method signatures unchanged.
Agent B: write xUnit tests for the migrated service. Assert that every page in
TestData/known/ returns its expected delivery note number and total, that
barcodes are returned when enabled, that a page without a total returns null,
and that reads below 80 confidence are flagged. Do not assert on full page
text.
```
[[i:(When running two agents in the desktop app, compare their Walkthroughs. Tests from the second agent are only valid if they run against the code the first agent produced. Also, verify how the confidence test obtains its low reading. In our test, it read the speckled note and asserted both the value and the flag.)]]
## How do you debug deployment failures on Linux, Docker, or Azure?
```text
Attach the terminal output to the Walkthrough when you are done. Reading
invoices works locally on Windows but fails in our Linux container with:
[PASTE FULL EXCEPTION AND STACK TRACE HERE]
Check which IronOCR package the project references, whether the container has
the native dependencies IronOCR needs, and whether IRONOCR_LICENSE_KEY reaches
the container. Explain the cause, then propose the change. Don't modify C#
code unless the cause is there.
```
Without clear instructions, an agent may suppress failures in a catch block. Point it to the [Docker guide](https://ironsoftware.com/ocr/csharp/get-started/docker/) and the [Azure guide](https://ironsoftware.com/ocr/csharp/get-started/azure/).
## What did the prompts produce in a real run?
The seven prompts that did not require pasted failures were submitted sequentially to the Antigravity CLI in a single session against a sample capture API. The application is an ASP.NET Core app with a legacy Tesseract reader, ten delivery notes with known values (including three rotated, two speckled, and four with QR codes), ten scanned sample invoices, and a German invoice. The license key was provided via an environment variable. After execution, an independent build, test run, and verification of each delivery note confirmed the results below.
- Known notes matched 10 of 10 with the legacy reader and 10 of 10 after the move to IronOCR, at confidence 76.2 to 96.0.
- xUnit tests passed 17 of 17.
- On the German invoice, IronOCR read 3.271,07 EUR at 95.5 confidence.
- Sample invoice totals matched 10 of 10.
- Builds succeeded 7 of 7 with 0 errors and no human edits.
- The plan-only prompt wrote code anyway and reported an approval nobody gave.
- Barcode tests silently skip the speckled QR note, which returns no barcode.
- Unlike the page, the session ran unattended with `--dangerously-skip-permissions`, and the two-agent prompt ran as one agent.
Antigravity's version, model, and timing, plus the test machine, are listed in the hub's [run record](/ocr/csharp/ai-agents/ai/#the-run-record).
---
## Troubleshooting
- [Apply a License Key in IronOCR](https://ironsoftware.com/ocr/csharp/troubleshooting/apply-a-license-key-in-ironocr/) if generated code throws LicensingException
- [Improve OCR Accuracy](https://ironsoftware.com/ocr/csharp/troubleshooting/improve-ocr-accuracy/) if values read from a page are wrong
- [Read Barcodes with IronOCR](https://ironsoftware.com/ocr/csharp/how-to/barcodes/) if barcodes are missing from a read that returned text
- [IronOCR on Docker](https://ironsoftware.com/ocr/csharp/get-started/docker/) if reads fail in a Linux container but work locally
---
## Questions?
If you have any questions, reach out to [support@ironsoftware.com](mailto:support@ironsoftware.com)
Many AI coding tools stop at code compilation and leave you to verify that the code works. In OCR, this gap can be costly. For example, an invoice importer may build and populate a database without errors, yet a quarter of the totals may contain misread digits, which the build output will not reveal.
Google Antigravity operates through agents that return work for your review. IronOCR extracts text, barcodes, and tables from images and PDFs locally in .NET. When the agent manages test pages, it knows their contents, reads each page with IronOCR, compares extracted values to known values, and iterates until they match.
This article covers AI coding tools that help you build software on IronOCR. IronOCR's own machine learning features for photographs and handwriting are a separate subject, with their own photo reading guide and handwriting guide.
Quickstart
Install with NuGet
PM > Install-Package IronOcr
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.
Open your project in Antigravity and specify the expected output.
/plan In this C# project, add IronOCR (the IronOcr NuGet package, namespaceIronOcr) and read the German invoice at TestData/rechnung.png, printing its textand overall confidence. Only English ships with the package, so add whateverGerman needs and tell me which package that was. Read the license key from theIRONOCR_LICENSE_KEY environment variable, never hardcode it. Run dotnet build,fix any errors, and show me the output.
/plan In this C# project, add IronOCR (the IronOcr NuGet package, namespace
IronOcr) and read the German invoice at TestData/rechnung.png, printing its text
and overall confidence. Only English ships with the package, so add whatever
German needs and tell me which package that was. Read the license key from the
IRONOCR_LICENSE_KEY environment variable, never hardcode it. Run dotnet build,
fix any errors, and show me the output.
Text
The plan should name IronOcr.Languages.German and the language assignment, and omitting either is an error. Without the language pack, the first read throws a LanguagePackException, so the mistake shows up at once.
The license key guide details all locations IronOCR checks for a key.
Check that the project compiles before you hand it to an agent
Reference the platform package that matches the host and load the key from settings
Give each task the pages, the language, the fields, and the values they should yield
Review the Implementation Plan, the diff, and the Walkthrough it hands back
What is Google Antigravity, and how is it different from a chat tool?
Given a goal, an Antigravity agent produces a plan, carries it out in the editor, the terminal, and a browser, and reports what it did in Artifacts you can review rather than a chat transcript.
Without guidance, an agent building a capture pipeline may pick the first OCR approach it finds or guess a package name. A guessed name can resolve to a counterfeit that an attacker published under that name in advance, a practice known as slopsquatting. Use IronOcr for Windows and IronOcr.Linux for Linux.
The AI coding assistants guide lists the IronOCR documentation links to give the agent and includes a single-prompt acceptance test you can run in Antigravity.
What does the agent hand back, and how do you review it?
Before the code, the Implementation Plan
The plan defines the files, language selection, filters, and target fields. Review it to confirm the scope.
During the run, the code diff
The code diff shows how the plan is implemented. Verify that the reader loads the specified pages, that promised filters are applied, and that every member used is present in the API reference.
After the run, the Walkthrough
The Walkthrough concludes the task by summarizing changes and providing evidence of results.
Where does the proof come from?
/browser Services/CaptureService.cs extracts delivery note numbers and totalsfrom uploads to POST /capture.1. Run the API and upload TestData/known/invoice-01.png in the browser. Capture a screenshot.2. Upload every file in TestData/known/ and record the delivery note number and total returned.3. Include the five rotated or noisy scans in that folder.4. Report a table of file, expected delivery note number, number returned, expected total, total returned, confidence, and match.5. If any row does not match, explain the cause before changing anything, fix it in CaptureService.cs, and run the whole table again. Attach the table and the screenshots as Artifacts.
/browser Services/CaptureService.cs extracts delivery note numbers and totals
from uploads to POST /capture.
1. Run the API and upload TestData/known/invoice-01.png in the browser.
Capture a screenshot.
2. Upload every file in TestData/known/ and record the delivery note number
and total returned.
3. Include the five rotated or noisy scans in that folder.
4. Report a table of file, expected delivery note number, number returned,
expected total, total returned, confidence, and match.
5. If any row does not match, explain the cause before changing anything, fix
it in CaptureService.cs, and run the whole table again. Attach the table
and the screenshots as Artifacts.
Text
Repeating the entire table afterward confirms that a filter added for one scan has not broken others.
From the CLI, the /browser command started a Chrome subagent.
Please note: Review the screenshot and any browser recording generated by Antigravity. If the agent skipped the upload form, it did not test the user workflow.
To flag a misread, such as a total with a transposed digit, comment on the screenshot.
What causes wrong or missing OCR values?
Most mismatches have a few common causes. Name the suspected cause and the agent skips the trial and error.
Wrong digits on rotated or noisy pages usually call for Deskew and DeNoise.
A read that returns text but no barcodes needs Configuration.ReadBarCodes turned on.
When ConvertToSearchablePdf throws on a scan, call SaveAsSearchablePdf on the read result instead.
How do you set up a project Antigravity can work in?
Provide the agent with a project that compiles. Otherwise, the agent spends its time on build errors.
Delegate installation to the agent.
Add the IronOcr NuGet package to this project. Then tell me which version wasinstalled and show me the PackageReference line. Configure the license key tobe read from the IRONOCR_LICENSE_KEY environment variable or a config filerather than hardcoded, and add that config file to .gitignore if it isn'talready. Don't change other package references.
Add the IronOcr NuGet package to this project. Then tell me which version was
installed and show me the PackageReference line. Configure the license key to
be read from the IRONOCR_LICENSE_KEY environment variable or a config file
rather than hardcoded, and add that config file to .gitignore if it isn't
already. Don't change other package references.
Text
Use the reported version number in all subsequent tasks.
Add a standing instructions file, AGENTS.md or GEMINI.md, to the repository root early in the project. Record that OCR uses IronOCR.
/learn The repository already carries an AGENTS.md from the ChatGPT Codexsetup, and this platform reads the same file. Extend its OCR section with therules this platform adds. Produce an Implementation Plan before any file isedited. Attach the evidence to the Walkthrough rather than describing it. Andtreat no task as finished until every page read is checked against a knownvalue.
/learn The repository already carries an AGENTS.md from the ChatGPT Codex
setup, and this platform reads the same file. Extend its OCR section with the
rules this platform adds. Produce an Implementation Plan before any file is
edited. Attach the evidence to the Walkthrough rather than describing it. And
treat no task as finished until every page read is checked against a known
value.
Text
In our run, the agent added the three rules to the existing instructions file.
How do you delegate extraction and migration work?
When you require field extraction, specify the relevant pages and the files the reader belongs in.
Show me the Implementation Plan before any file is written. Then createServices/DeliveryNoteReader.cs with a method that takes the path of a scannedPDF, reads it with IronTesseract, and returns the amount on the linecontaining Total due with that line's confidence, or null if the line ismissing. Create Services/SearchablePdf.cs with a method that writes asearchable copy of a scanned PDF. Build, then prove ten sample invoices returntheir known totals.
Show me the Implementation Plan before any file is written. Then create
Services/DeliveryNoteReader.cs with a method that takes the path of a scanned
PDF, reads it with IronTesseract, and returns the amount on the line
containing Total due with that line's confidence, or null if the line is
missing. Create Services/SearchablePdf.cs with a method that writes a
searchable copy of a scanned PDF. Build, then prove ten sample invoices return
their known totals.
Text
In our test, the reader loaded each scan as a PDF input and searched every page's lines for the Total due line.
Migrations are well-suited for delegation, as they are lengthy, repetitive, and prone to overlooked edge cases. Point the agent at the current source code.
/plan Read Capture/LegacyCaptureService.cs. It reads scans with another OCRlibrary.1. List every read it performs, with the settings it uses.2. Map each setting to its IronOCR equivalent, citing the documentation page.3. Produce this as a plan Artifact. Do not write code yet.
/plan Read Capture/LegacyCaptureService.cs. It reads scans with another OCR
library.
1. List every read it performs, with the settings it uses.
2. Map each setting to its IronOCR equivalent, citing the documentation page.
3. Produce this as a plan Artifact. Do not write code yet.
Text
The desktop app holds the plan for your review. From the CLI, review the diff after a plan task.
OCR migrations can be divided into two parallel tasks.
Agent A: migrate Capture/LegacyCaptureService.cs to IronOCR per the approvedplan. Keep the public method signatures unchanged.Agent B: write xUnit tests for the migrated service. Assert that every page inTestData/known/ returns its expected delivery note number and total, thatbarcodes are returned when enabled, that a page without a total returns null,and that reads below 80 confidence are flagged. Do not assert on full pagetext.
Agent A: migrate Capture/LegacyCaptureService.cs to IronOCR per the approved
plan. Keep the public method signatures unchanged.
Agent B: write xUnit tests for the migrated service. Assert that every page in
TestData/known/ returns its expected delivery note number and total, that
barcodes are returned when enabled, that a page without a total returns null,
and that reads below 80 confidence are flagged. Do not assert on full page
text.
Text
Please note: When running two agents in the desktop app, compare their Walkthroughs. Tests from the second agent are only valid if they run against the code the first agent produced. Also, verify how the confidence test obtains its low reading. In our test, it read the speckled note and asserted both the value and the flag.
How do you debug deployment failures on Linux, Docker, or Azure?
Attach the terminal output to the Walkthrough when you are done. Readinginvoices works locally on Windows but fails in our Linux container with:[PASTE FULL EXCEPTION AND STACK TRACE HERE]Check which IronOCR package the project references, whether the container hasthe native dependencies IronOCR needs, and whether IRONOCR_LICENSE_KEY reachesthe container. Explain the cause, then propose the change. Don't modify C#code unless the cause is there.
Attach the terminal output to the Walkthrough when you are done. Reading
invoices works locally on Windows but fails in our Linux container with:
[PASTE FULL EXCEPTION AND STACK TRACE HERE]
Check which IronOCR package the project references, whether the container has
the native dependencies IronOCR needs, and whether IRONOCR_LICENSE_KEY reaches
the container. Explain the cause, then propose the change. Don't modify C#
code unless the cause is there.
Text
Without clear instructions, an agent may suppress failures in a catch block. Point it to the Docker guide and the Azure guide.
What did the prompts produce in a real run?
The seven prompts that did not require pasted failures were submitted sequentially to the Antigravity CLI in a single session against a sample capture API. The application is an ASP.NET Core app with a legacy Tesseract reader, ten delivery notes with known values (including three rotated, two speckled, and four with QR codes), ten scanned sample invoices, and a German invoice. The license key was provided via an environment variable. After execution, an independent build, test run, and verification of each delivery note confirmed the results below.
Known notes matched 10 of 10 with the legacy reader and 10 of 10 after the move to IronOCR, at confidence 76.2 to 96.0.
xUnit tests passed 17 of 17.
On the German invoice, IronOCR read 3.271,07 EUR at 95.5 confidence.
Sample invoice totals matched 10 of 10.
Builds succeeded 7 of 7 with 0 errors and no human edits.
The plan-only prompt wrote code anyway and reported an approval nobody gave.
Barcode tests silently skip the speckled QR note, which returns no barcode.
Unlike the page, the session ran unattended with --dangerously-skip-permissions, and the two-agent prompt ran as one agent.
Antigravity's version, model, and timing, plus the test machine, are listed in the hub's run record.
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.