Make PDF Searchable

The code below shows you how to add a searchable text layer to PDF using OCR.

This sample requires a Professional+OCR license. If you use a Trial License then the generated file will contain some mangled words.

using System;
using System.IO;
using SolidFramework.Converters.Plumbing;
using SolidFramework.Converters;

namespace OCRforSearch
    class Program
        static void Main(string[] args)
            // Call your Solid Documents License

            // Set the location of your the file you want to convert
            String pdfPath = @"C:\YourFolder\yourpdf.pdf";

            // Set the file extension you are creating
            String strPDFAPath = Path.ChangeExtension(pdfPath, "pdfa.pdf");

            //*Create a Searchable PDF/A*//
            using (PdfToPdfAConverter converter = new PdfToPdfAConverter())
                // Make the Converted File Searchable
                converter.OcrType = SolidFramework.Converters.Plumbing.OcrType.CreateSearchableTextLayer;

                // Set the PDF/A Validation
                converter.ValidationMode = SolidFramework.Plumbing.ValidationMode.PdfA2B; // All other PDFA formats are available

                // Then add the Source File

                // Convert the file, setting overwrite to true
                converter.ConvertTo(pdfPath, true);

                //Show the status of the PDF file in the Console Window
                SolidFramework.Converters.Plumbing.ConversionStatus status = converter.ConvertTo(strPDFAPath, true);
                if (status != ConversionStatus.Success)
#include "stdafx.h"
#include "SolidFramework.h"

#include <iostream>
using  namespace std;

void DoProgress(SolidFramework::ProgressEventArgsPtr args)
    // Not implemented

void DoWarning(SolidFramework::WarningEventArgsPtr args)
    // Not implemented

class PdfToPdfAConverter : public SolidFramework::Converters::PdfToPdfAConverterBase
    void FireProgress(SolidFramework::ProgressEventArgsPtr args) override { DoProgress(args); };
    void FireWarning(SolidFramework::WarningEventArgsPtr args) override { DoWarning(args); };

int _tmain(int argc, _TCHAR* argv[])
    // Enter your License code goes here

    // Create a PDF to Word Converter called converter
    PdfToPdfAConverter *converter = new PdfToPdfAConverter();

    SolidFramework::Converters::CustomData *pData = NULL;
    pData = new SolidFramework::Converters::CustomData();
    pData->Converter = converter;
    pData->Data = nullptr;

    // Add the PDF file to convert.

    // Make the Converted File Searchable 

    // Set the PDF/A Validation 
    converter->setValidationMode(SolidFramework::Plumbing::ValidationMode::PdfA2B); // All PDF/A options are supported

    //Start the Conversion
    cout << "Starting conversion." << endl; converter->Convert();

    SolidFramework::Converters::Plumbing::ConversionStatus status = converter->getResults()->getItem(0)->getStatus();
    if (status != SolidFramework::Converters::Plumbing::ConversionStatus::Success)
        cout << "Conversion failed." << endl;
        cout << "Conversion succeeded." << endl; } converter->Dispose();

    cout << "Press <Enter> to exit." << endl;

    return 0;
Imports System.IO
Imports SolidFramework.Converters.Plumbing
Imports SolidFramework.Plumbing

Module OCRforSearch

    Sub Main()

        ' Call your Solid Documents License

        'Define a variable for your source file
        Dim sPdfPath As String

        ' Define a String for the output file
        Dim pdfaPath As String

        ' Define your Solid Framework Converter
        Dim myConverter As SolidFramework.Converters.PdfToPdfAConverter

        ' Set your file path 
        sPdfPath = "C:\YourFolder\yourpdf.pdf"

        ' Set your output file and location
        pdfaPath = Path.ChangeExtension(sPdfPath, ".pdfa.pdf")

        ' Set the converter
        myConverter = New SolidFramework.Converters.PdfToPdfAConverter

        'Set the preferred conversion properties 

        ' Add files to convert. 

        ' Detect Headers and Footers
        myConverter.ValidationMode = ValidationMode.PdfA2B ' All ofther PDFA formats are available

        ' Make the Converted File Searchable 
        myConverter.OcrType = OcrType.CreateSearchableTextLayer

        ' Convert the File.
        myConverter.ConvertTo(pdfaPath, True)

        ' Clean up

    End Sub

End Module