Can i get code for Pdf to searchable PDF

Can i get sample code pdf to searchable pdf, here i get online conversion from Aspose site



Could you please specify your development environment? Are you looking for .NET variant of the API/code or Java?

i am looking in vb or c#


Please take a look at this Convert PDF to Searchable PDF in C#. However, in case of any back-end API related issue, please feel free to post on Aspose forum.

I am getting this error " System.outofmemory.exception" , here i attach error screenshot

This is my code in vb

Imports System.IO
Imports Aspose.OCR

Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim ocr As AsposeOcr = New AsposeOcr()
Dim riText As String = ocr.RecognizeImage(“E:\Data\scansmpl.pdf”)
File.WriteAllText(“E:\Data\1410.pdf”, riText)
End Sub
End Class

I am using Windows 11 and Aspose.Ocr version is 22.9.0



Can you please share your sample PDF file as well? We will test the scenario in our environment and address it accordingly.

here i attach sample pdf filetest.pdf (21.0 KB)


We believe it is the same file that you shared in your previous thread. We have added our response there for this file.

Yes same file, all pdf get same error System out of memory exception"


We did not face such exception at our side. Would you please share your sample application with us so that we can try to replicate this issue in our environment and address it accordingly.

Hi, here i attach sample application which i get same error as mention in previous post.
Sample application download link

Please check at your end.


We are checking it and will get back to you shortly.


We checked the application that you shared. We noticed two things:

  • Code to recognize PDF was not there (you were using RecognizeImage() method)
  • Not all dependencies were installed

We did following to fix it and produce output without any issues:

  • Installed Aspose.OCR from NuGet Gallery so all dependencies were installed correctly
  • Used below code to recognize PDF

image.png (84.2 KB)