This API will generate the searchable pdf. It takes the input tif/tiff file and rsp file for processing when recostar engine is used. Input parameters isColorImage and isSearchableImage will be used to specify the generated output pdf to be coloured or searchable.

Request Method POST

Input Parameters

Input Parameter Values Descriptions
isColorImage Either “true”/”false” Generates the color pdf if input image is color and value is “true”.
isSearchableImage Either “true”/”false” Generates the searchable pdf if value is “true”.
outputPDFFileName String value should ends with .pdf extension Output pdf file name generated using API.
projectFile String value should ends with .rsp extension RSP file used as recostar processing.
ocrEngine Recostar or Nuance String value for the engine used in ocr.


Web Service url: http://{serverName}:{port}/dcma/rest/createSearchablePDF


  1. Input only tiff/tif files for generating searchable pdf.
  2. RSP file is mandatory for generating the searchable pdf in case of Recostar and must be named FPR.rsp in all cases.

Sample client code using apache commons http client:-

private static void createSearchablePDF() {
		HttpClient client = new HttpClient();
		String url = "http://localhost:8080/dcma/rest/createSearchablePDF";
		PostMethod mPost = new PostMethod(url);
		File file1 = new File("C:\\sample\\sample1.tif");
		File file2 = new File("C:\\sample\\Fpr.rsp");
		Part[] parts = new Part[7];
		try {
			parts[0] = new FilePart(file1.getName(), file1);
			parts[1] = new FilePart(file2.getName(), file2);
			parts[2] = new StringPart("isColorImage", "false");
			parts[3] = new StringPart("isSearchableImage", "true");
			parts[4] = new StringPart("outputPDFFileName", "OutputPDF.pdf");
			parts[5] = new StringPart("projectFile", "Fpr.rsp");
			parts[6] = new StringPart("ocrEngine", "Recostar");
			MultipartRequestEntity entity = new MultipartRequestEntity(parts, mPost.getParams());
			int statusCode = client.executeMethod(mPost);
			if (statusCode == 200) {
				InputStream inputStream = mPost.getResponseBodyAsStream();
				String outputFilePath = "C:\\sample\\Output.pdf";
				File file = new File(outputFilePath);
				FileOutputStream fileOutputStream = new FileOutputStream(file);
				try {
					byte[] buf = new byte[1024];
					int len =;
					while (len > 0) {
						fileOutputStream.write(buf, 0, len);
						len =;
				} finally {
					if (fileOutputStream != null) {
				System.out.println("Web service executed successfully.");
			} else if (statusCode == 403) {
				System.out.println("Invalid username/password.");
			} else {
		} catch (FileNotFoundException e) {
			System.err.println("File not found for processing.");
		} catch (HttpException e) {
		} catch (IOException e) {
		} finally {
			if (mPost != null) {

Was this article helpful to you?


Comments are closed.