private static Process action ( final String fileName , String parameters , boolean waitForTermination ) throws IOException { Process process = null ; if ( parameters . trim ( ) . length ( ) > 0 ) { parameters = " " + parameters . trim ( ) ; } else { parameters = "" ; } if ( acroread != null ) { process = Runtime . getRuntime ( ) . exec ( acroread + parameters + " \"" + fileName + "\"" ) ; } else if ( isWindows ( ) ) { if ( isWindows9X ( ) ) { process = Runtime . getRuntime ( ) . exec ( "command.com /C start acrord32" + parameters + " \"" + fileName + "\"" ) ; } else { process = Runtime . getRuntime ( ) . exec ( "cmd /c start acrord32" + parameters + " \"" + fileName + "\"" ) ; } } else if ( isMac ( ) ) { if ( parameters . trim ( ) . length ( ) == 0 ) { process = Runtime . getRuntime ( ) . exec ( new String [ ] { "/usr/bin/open" , fileName } ) ; } else { process = Runtime . getRuntime ( ) . exec ( new String [ ] { "/usr/bin/open" , parameters . trim ( ) , fileName } ) ; } } try { if ( process != null && waitForTermination ) process . waitFor ( ) ; } catch ( InterruptedException ie ) { } return process ; }
Performs an action on a PDF document .