fluid-api/src/main/java/com/fluidbpm/program/api/util/command/impl/DocumentToPDFConvert.java
public File convertDocumentToPDF(File inputDocumentParam) {

		if(inputDocumentParam == null ||
				!inputDocumentParam.exists())
		{
			throw new UtilException(
					"Input document to convert not provided or does not exist.",
					UtilException.ErrorCode.COMMAND);
		}

		if(!inputDocumentParam.isFile())
		{
			throw new UtilException(
					"Input document '' is not a file.",
					UtilException.ErrorCode.COMMAND);
		}

		File parentFolder = inputDocumentParam.getParentFile();
		String inputFilenameWithoutExt = inputDocumentParam.getName();

		int indexOfDot = -1;
		if((indexOfDot = inputFilenameWithoutExt.indexOf('.')) > -1)
		{
			inputFilenameWithoutExt = inputFilenameWithoutExt.substring(0,indexOfDot);
		}

		File generatedPdfFileOut = new File(parentFolder.getAbsolutePath().concat(
				File.separator).concat(inputFilenameWithoutExt).concat(".pdf"));

		String completeOutputPath = generatedPdfFileOut.getAbsolutePath();

		try {
			CommandUtil.CommandResult commandResult =
					this.commandUtil.executeCommand(
							CommandUtil.FLUID_CLI,
							COMMAND_CONVERT_DOC_TO_PDF,
							"-i",
							inputDocumentParam.getAbsolutePath(),
							"-o",
							completeOutputPath);

			//There is a problem...
			if(commandResult.getExitCode() != 0)
			{
				throw new UtilException(
						"Unable to convert '"+
								inputDocumentParam.getName()+
								"' to PDF. "+ commandResult.toString(),
						UtilException.ErrorCode.COMMAND);
			}

			File returnVal = new File(completeOutputPath);
			if(!returnVal.exists())
			{
				throw new UtilException(
						"Command executed, but no output file. Expected PDF at '"+
								completeOutputPath+"'.",
						UtilException.ErrorCode.GENERAL);
			}

			return returnVal;
		}
		//
		catch (IOException eParam) {

			throw new UtilException(
					"Problem executing command. "+eParam.getMessage(),
					eParam,UtilException.ErrorCode.GENERAL);
		}
	}
public File convertDocumentToPDF(File inputDocumentParam) {

		if(inputDocumentParam == null ||
				!inputDocumentParam.exists())
		{
			throw new UtilException(
					"Input document to convert not provided or does not exist.",
					UtilException.ErrorCode.COMMAND);
		}

		if(!inputDocumentParam.isFile())
		{
			throw new UtilException(
					"Input document '' is not a file.",
					UtilException.ErrorCode.COMMAND);
		}

		File parentFolder = inputDocumentParam.getParentFile();
		String inputFilenameWithoutExt = inputDocumentParam.getName();

		int indexOfDot = -1;
		if((indexOfDot = inputFilenameWithoutExt.indexOf('.')) > -1)
		{
			inputFilenameWithoutExt = inputFilenameWithoutExt.substring(0,indexOfDot);
		}

		File generatedPdfFileOut = new File(parentFolder.getAbsolutePath().concat(
				File.separator).concat(inputFilenameWithoutExt).concat(".pdf"));

		String completeOutputPath = generatedPdfFileOut.getAbsolutePath();

		try {
			CommandUtil.CommandResult commandResult =
					this.commandUtil.executeCommand(
							CommandUtil.FLUID_CLI,
							COMMAND_CONVERT_DOC_TO_PDF,
							"-i",
							inputDocumentParam.getAbsolutePath(),
							"-o",
							completeOutputPath);

			//There is a problem...
			if(commandResult.getExitCode() != 0)
			{
				throw new UtilException(
						"Unable to convert '"+
								inputDocumentParam.getName()+
								"' to PDF. "+ commandResult.toString(),
						UtilException.ErrorCode.COMMAND);
			}

			File returnVal = new File(completeOutputPath);
			if(!returnVal.exists())
			{
				throw new UtilException(
						"Command executed, but no output file. Expected PDF at '"+
								completeOutputPath+"'.",
						UtilException.ErrorCode.GENERAL);
			}

			return returnVal;
		}
		//
		catch (IOException eParam) {

			throw new UtilException(
					"Problem executing command. "+eParam.getMessage(),
					eParam,UtilException.ErrorCode.GENERAL);
		}
	}
Makes use of the Fluid Core to convert a document into a PDF file.

@param inputDocumentParam The file to convert to PDF.
@return The {@code File} object of the result PDF.

@throws UtilException If anything goes wrong during execution.