Using an OcrTransformer to add a Searchable Text Layer
The code below shows you how to use an OcrTransformer to add a searchable text layer to a PDF.
This sample requires a Professional+OCR license.
C#
    
using System;
using System.IO;
using SolidFramework.Converters.Plumbing;
using SolidFramework.Plumbing;
using SolidFramework.Pdf;
using SolidFramework.Pdf.Transformers;
namespace PDFTransformers
{
    class Program
    {
        [STAThread]
        static void Main(string[] args)
        {
            // Call your Solid Documents License
            SolidFramework.License.Import(@"C:\MyFolder\license.xml");
            // Set the location of your the file you want to convert
            String pdfPath = @"C:\YourFolder\yourpdf.pdf";
            String searchablePdfPath = Path.ChangeExtension(pdfPath, "searchable.pdf");
            //*PDF Transformer*//
            // Create a new PdfDocument Object called document and assign the selected PDF file to it 
            using (PdfDocument document = new PdfDocument(pdfPath))
            {                
                // Create a new OCRTransformer Object 
                OcrTransformer transformer = new OcrTransformer();
                // Set the OcrType to Create a Searchable TextLayer 
                transformer.OcrType = OcrType.CreateSearchableTextLayer;
                // Set the OCR Language to the Language in your PDF File - "en" for English, "es" for Spanish etc. 
                transformer.OcrLanguage = "en";
                // Preserve the Original PDF Files Image Compression 
                transformer.OcrImageCompression = SolidFramework.Imaging.Plumbing.ImageCompression.PreserveOriginal;
                // Add the user selected PDF file to your transformer 
                transformer.AddDocument(document);
                // Transform the PDF File 
                transformer.Transform();
                // Save the new Searchable PDF file to the extension you specified earlier 
                document.SaveAs(searchablePdfPath, OverwriteMode.ForceOverwrite);
            }
        }
    }
}
        C++
    This sample is not currently available in C++.
VB.Net
    
Imports System.IO
Imports SolidFramework.Converters.Plumbing
Imports SolidFramework.Plumbing
Imports SolidFramework
Imports SolidFramework.Pdf
Module PDFTransformers
    Sub Main()
        ' Call your Solid Documents License
        SolidFramework.License.Import("C:\MyFolder\license.xml")
        'Define a variable for your source file
        Dim sPdfPath As String
        ' Define a String for the output file
        Dim searchPath As String
        ' Define a PDF Document object
        Dim myDocument As SolidFramework.Pdf.PdfDocument
        ' Define your Solid Framework Converter
        Dim myConverter As SolidFramework.Pdf.Transformers.OcrTransformer
        ' Set your file path 
        sPdfPath = "C:\YourFolder\filepdf.pdf"
        myDocument = New PdfDocument(sPdfPath)
        ' Set your output file and location
        searchPath = Path.ChangeExtension(sPdfPath, ".searchable.pdf")
        ' Set the converter
        myConverter = New SolidFramework.Pdf.Transformers.OcrTransformer
        ' Set the OcrType to Create a Searchable TextLayer 
        myConverter.OcrType = OcrType.CreateSearchableTextLayer
        ' Set the OCR Language to the Language in your PDF File - "en" for English, "es" for Spanish etc. 
        myConverter.OcrLanguage = "de"
        ' Preserve the Original PDF Files Image Compression 
        myConverter.OcrImageCompression = Imaging.Plumbing.ImageCompression.PreserveOriginal
        ' Add the user selected PDF file to your transformer 
        myConverter.AddDocument(myDocument)
        ' Transform the PDF File 
        myConverter.Transform()
        ' Save the new Searchable PDF file to the extension you specified earlier 
        myDocument.SaveAs(searchPath, OverwriteMode.ForceOverwrite)
        ' Close the document and clean up
        myDocument.Close()
        myDocument.Dispose()
    End Sub
End Module
        