Integrate Our OCR SDK into a .NET Application
This guide discusses the extra packages required to run OCR with the PSPDFKit .NET Library and helps you integrate the dependencies into your project. For information on the functionality of OCR, please refer to our OCR overview guide. If you want to know how to use the OCR classes, please refer to our OCR usage guide.
Integration of the PSPDFKitOcr.NET Package
To integrate PSPDFKitOcr.NET, you have to download the PSPDFKit .NET Library binary from the PSPDFKit Customer Portal or as part of the trial process (found under Advanced Integration on the trial page). Extract the binary into a known location for use in the following steps.
You then need to instruct your project to use a local NuGet source to obtain the PSPDFKitOcr.NET package with a local NuGet configuration.
The local configuration is described by a file named nuget.config
, which is placed next to your solution file (e.g Test.sln
).
The file should contain a configuration
XML element with a child of packageSources
. packageSources
holds multiple add
elements describing where to find NuGet packages.
If nuget.config Already Exists
If nuget.config
already exists, add the extra packageSources
pointing to the directory holding the *.nupkg
files. The files can be found in the nuget
directory from the extracted PSPDFKit binary:
<?xml version="1.0" encoding="utf-8"?> <configuration> <packageSources> ... <add key="PSPDFKitSource" value="path/to/directory/containing/nupkg" /> ... </packageSources> </configuration>
If There Is No nuget.config File Present
If there is no nuget.config
file present, create the nuget.config
file and copy and paste the following source into the newly created file:
<?xml version="1.0" encoding="utf-8"?> <configuration> <packageSources> <add key="PSPDFKitSource" value="path/to/directory/containing/nupkg" /> </packageSources> </configuration>
Edit the value of the contents to correctly refer to the location of the directory containing the PSPDFKitOcr.NET-1.4.1.nupkg
package. The file can be found in the nuget
directory from the extracted PSPDFKit binary.
Adding the PSPDFKit OCR NuGet Package
Now that you have the NuGet source, you can add the package to the project:
-
cd
into your project solution. -
Add the package by running
dotnet add <PROJECT_NAME> package PSPDFKitOcr.NET
, replacing<PROJECT_NAME>
with the project you want to add the package to. -
Now restore all the newly added packages with
dotnet restore
. You will need an internet connection to retrieve the dependency projects.
You have now set up your project to use the PSPDFKitOcr.NET package.