We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Can i get code for Pdf to searchable PDF

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

Regards
Aravind

@bpanchu

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#

@bpanchu

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.

Hi
I am getting this error " System.outofmemory.exception" , here i attach error screenshot
https://prnt.sc/Bz8wNE1NyNtP

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

Regards
Aravind

@bpanchu

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)

@bpanchu

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"

@bpanchu

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.

@bpanchu

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

@bpanchu

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)