You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/applied-ai-services/form-recognizer/quickstarts/try-v3-csharp-sdk.md
+1-329Lines changed: 1 addition & 329 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -344,333 +344,6 @@ foreach (DocumentPage page in result.Pages)
344
344
}
345
345
}
346
346
347
-
foreach (DocumentStylestyleinresult.Styles)
348
-
{
349
-
// Check the style and style confidence to see if text is handwritten.
350
-
// Note that value '0.8' is used as an example.
351
-
352
-
boolisHandwritten=style.IsHandwrGetstartedwithAzureFormRecognizerusingtheC# programminglanguage. AzureFormRecognizerisacloud-basedAzureAppliedAIServicethatusesmachinelearningtoextractkey-valuepairs, text, andtablesfromyourdocuments. YoucaneasilycallFormRecognizermodelsbyintegratingourclientlibrarySDksintoyourworkflowsandapplications. Werecommendthatyouusethefreeservicewhenyou're learning the technology. Remember that the number of free pages is limited to 500 per month.
*Thecurrentversionof [VisualStudioIDE](https://visualstudio.microsoft.com/vs/). <!-- or [.NET Core](https://dotnet.microsoft.com/download). -->
369
-
370
-
*ACognitiveServicesorFormRecognizerresource. OnceyouhaveyourAzuresubscription, createa [single-service](https://portal.azure.com/#create/Microsoft.CognitiveServicesFormRecognizer) or [multi-service](https://portal.azure.com/#create/Microsoft.CognitiveServicesAllInOne) Form Recognizer resource in the Azure portal to get your key and endpoint. You can use the free pricing tier (`F0`) to try the service, and upgrade later to a paid tier for production.
371
-
372
-
> [!TIP]
373
-
>CreateaCognitiveServicesresourceifyouplantoaccessmultiplecognitiveservicesunderasingleendpoint/key. ForFormRecognizeraccessonly, createaFormRecognizerresource. Pleasenotethatyou'lll need a single-service resource if you intend to use [Azure Active Directory authentication](../../../active-directory/authentication/overview-authentication.md).
1. Choose the **Include prerelease** checkbox and select version **4.0.0-beta.3*** from the dropdown menu and install the package in your project.
447
-
448
-
449
-
450
-
<!-- --- -->
451
-
## Build your application
452
-
453
-
To interact with the Form Recognizer service, you'll need to create an instance of the `DocumentAnalysisClient` class. To do so, you'll create an `AzureKeyCredential` with your apiKey and a `DocumentAnalysisClient` instance with the `AzureKeyCredential` and your Form Recognizer `endpoint`.
454
-
455
-
> [!NOTE]
456
-
>
457
-
> * Starting with .NET 6, new projects using the `console` template generate different code than previous versions.
458
-
> * The new output uses recent C# features that simplify the code you need to write for a program.
459
-
> * When you use the newer version, you only need to write the body of the `Main` method. You don't need to include the other program elements.
460
-
> * For more information, *see* [**New C# templates generate top-level statements**](/dotnet/core/tutorials/top-level-templates).
461
-
462
-
1. Open the **Program.cs** file.
463
-
464
-
1. Include the following using directives:
465
-
466
-
```csharp
467
-
using Azure;
468
-
using Azure.AI.FormRecognizer.DocumentAnalysis;
469
-
```
470
-
471
-
1. Add the following code snippet to your Program.cs file. Set your `endpoint` and `apiKey` environment variables and create your `AzureKeyCredential` and `DocumentAnalysisClient` instance:
472
-
473
-
```csharp
474
-
string endpoint = "<your-endpoint>";
475
-
string apiKey = "<your-apiKey>";
476
-
AzureKeyCredential credential = new AzureKeyCredential(apiKey);
477
-
DocumentAnalysisClient client = new DocumentAnalysisClient(newUri(endpoint), credential);
478
-
```
479
-
1. Add a async modifier to you Main method.
480
-
481
-
1. Delete the line, `Console.Writeline("Hello World!");` , and add one of the code sample scripts listed below to the file:
482
-
483
-
:::image type="content" source="../media/quickstarts/add-code-here.png" alt-text="Screenshot: add the sample code to the Main method.":::
484
-
485
-
> [!TIP]
486
-
> If you would like to try more than one code sample:
487
-
>
488
-
> * Select one of the sample code blocks below to copy and paste into your application.
489
-
> * [**Run your application**](#run-your-application).
490
-
> * Comment out that sample code block but keep the set-up code and library directives.
491
-
> * Select another sample code block to copy and paste into your application.
492
-
> * [**Run your application**](#run-your-application).
493
-
> * You can continue to comment out, copy/paste, and run the sample blocks of code.
494
-
495
-
### Select one of the following code samples to copy and paste into your application Program.cs file:
> Remember to remove the key from your code when you're done, and never post it publicly. For production, use secure methods to store and access your credentials. For more information, _see_ the Cognitive Services [security](../../../cognitive-services/cognitive-services-security.md) article.
506
-
507
-
## General document model
508
-
509
-
Extract text, tables, structure, key-value pairs, and named entities from documents.
510
-
511
-
> [!div class="checklist"]
512
-
>
513
-
> * For this example, you'll need a **form document file from a URI**. You can use our [sample form document](https://raw.githubusercontent.com/Azure-Samples/cognitive-services-REST-api-samples/master/curl/form-recognizer/sample-layout.pdf) for this quickstart.
514
-
>*ToanalyzeagivenfileataURI, you'll use the `StartAnalyzeDocumentFromUri` method. The returned value is an `AnalyzeResult` object containing data about the submitted document.
515
-
>*We've added the file URI value to the `Uri fileUri` variable at the top of the script.
>*Forthisexample, you'll need a **form document file from a URI**. You can use our [sample form document](https://raw.githubusercontent.com/Azure-Samples/cognitive-services-REST-api-samples/master/curl/form-recognizer/sample-layout.pdf) for this quickstart.
629
-
>*We've added the file URI value to the `Uri fileUri` variable at the top of the script.
0 commit comments