pdfOCR: Custom session options for an ONNX model
The release of pdfOCR 5.0.0 introduced support for pretrained ONNX PaddleOCR and EasyOCR models, adding to the docTR models already supported.
The following code sample shows an example of customizing the ONNX Runtime session configuration used by the pdfOCR ONNX-based engine when creating searchable PDFs from images.
Check the comments in the example for more details on customizing session options.
Compatible PaddleOCR/EasyOCR models already converted to ONNX format are available from our Hugging Face repository.
Java
##GITHUB:https://github.com/itext/itext-publications-examples-java/blob/develop/src/main/java/com/itextpdf/samples/sandbox/pdfocr/onnx/CustomOnnxRuntimeSessionOptionsExample.java##
C#
##GITHUB:https://github.com/itext/itext-publications-samples-dotnet/blob/develop/itext/itext.samples/itext/samples/sandbox/pdfocr/onnx/CustomOnnxRuntimeSessionOptionsExample.cs##