This API will break the pdf and multipage tiff file into single page tiff.  The API uses image magick and ghost script for splitting the input file. This API will have following parameter for configuration.

Request Method POST

Input Parameters

Input Parameter Values Descriptions
inputParams For Image Magick:

This value can be empty.  Reference for image magick parameter.

For Ghost Script:

This value should not be empty. Reference for ghost script input parameter :

This parameter will used for both image magick and ghost script.
outputParams For Image Magick:

This value can be empty.  Reference for image magick parameter.

This are the image magick output parameters used for optimizing the output file.
isGhostscript Either “true”/”false” This parameter is used to specified the weather ghost script is using for breaking the pdf/multipage tiff into single page tiff.


Web Service URL: http://{serverName}:{port}/dcma/rest/splitMultipageFile


  1. Input only tiff and pdf file only.
  2. If “isGhostscript” is “true”, then only input params will work and PDF files will be split.
  • If “isGhostscript” is “false”, then input params and output params will work.


Sample client code using apache commons http client:-

private static void splitMultiPageFile() {
		HttpClient client = new HttpClient();
		String url = "http://localhost:8080/dcma/rest/splitMultipageFile";
		PostMethod mPost = new PostMethod(url);

		File file1 = new File("C:\\sample\\sample.tif");

		Part[] parts = new Part[4];
		try {
			parts[0] = new FilePart(file1.getName(), file1);
			parts[1] = new StringPart("inputParams", "gswin32c.exe -dNOPAUSE -r300 -sDEVICE=tiff12nc -dBATCH");
			parts[2] = new StringPart("isGhostscript", "true");
			parts[3] = new StringPart("outputParams", "");

			MultipartRequestEntity entity = new MultipartRequestEntity(parts, mPost.getParams());

			int statusCode = client.executeMethod(mPost);
			if (statusCode == 200) {
				InputStream in = mPost.getResponseBodyAsStream();
				File file = new File("C:\\sample\\");
				FileOutputStream fos = new FileOutputStream(file);
				try {
					byte[] buf = new byte[1024];
					int len =;
					while (len > 0) {
						fos.write(buf, 0, len);
						len =;
				} finally {
					if (fos != 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.