Skip to content

Latest commit

 

History

History
48 lines (25 loc) · 2.52 KB

File metadata and controls

48 lines (25 loc) · 2.52 KB

Sample - Carry out OCR using Java

The Java sample provided in this section uses the Muhimbi PDF Converter Services Online to recognise text in image based files (scans, faxes, etc) using Optical Character Recognition (OCR). The OCRed content is returned in a PDF file with selectable and fully searchable text.

Additional sample code to convert, merge, watermark, secure and OCR files can be found here.

Full details about the ocr_pdf method, fields and properties can be found in the Wiki.


Downloading the sample

Download the sample code using a method of your choice. Some examples are provided below.

  • Git: Clone the entire repository to your system. You can find the examples under the clients/v1/java/samples folder.

    git clone https://github.com/Muhimbi/PDF-Converter-Services-Online

  • SVN: A common trick to download only part of a Git repository is to use svn. Download only the Java client and sample code using the following command.

    svn export https://github.com/Muhimbi/PDF-Converter-Services-Online/trunk/clients/v1/java

  • ZIP: Download a ZIP archive of the entire repository. Once downloaded, you can find the examples under the clients/v1/java/samples folder.


Use a valid (or trial) subscription

In order to successfully execute the sample code, make sure you have a valid subscription, either a full one or the 30 day trial.

❗ Each subscription comes with a unique api_key. Before executing the sample, please insert your key in the code. ❗


Building and running the sample

Make sure the prerequisites are in place. The sample code expects the client libraries to be present under ../../client/lib.

Scripts are provided to build and execute the sample code:

  • Linux: build_and_run.sh
  • Windows: build_and_run.bat

Once the sample has completed the OCR process, the results are written to result.pdf. Open it in your favourite PDF reader to have a look.


If you have any questions or comments then please contact our friendly support desk.