Use the Swftools software tool to convert PDF documents to SWF documents for use in Flexpaperviewer
Import java.io.IOException;
Import Java.io.InputStreamReader;
public class Stringutil {public static Boolean executecmdflash (String cmd) {stringbuffer stdout=new stringbuffer ();
Try {final Process process = Runtime.getruntime (). exec (CMD);
Runtime.getruntime (). Addshutdownhook (New Thread () {public void run () {Process.destroy ());
}
});
InputStreamReader InputStreamReader = new InputStreamReader (process. getInputStream ());
char C = (char) inputstreamreader.read ();
if (c!= '? ')
Stdout.append (c); while (c!= '? ')
{if (!inputstreamreader.ready ()) {System.out.println (stdout);
try {process.exitvalue ();
Break
catch (Illegalthreadstateexception _ex) {try {thread.sleep (100L);
The catch (Interruptedexception _ex2) {}}} else {c = (char) inputstreamreader.read ();
Stdout.append (c);
} try {inputstreamreader.close (); catch (IOException IoexcepTion2) {System.err.println ("Runcmd:error closing InputStream" + Ioexception2);
return false;
} catch (Throwable e) {e.printstacktrace ();
Globals.logger ("Error occurred:" + E, 2);
return false;
return true; /** * get filename, remove suffix * @param file * @return/public static string GetFileName (string file) {if File!=null & amp;& file.indexof (".")!
=-1) {return file.substring (0,file.indexof ("."));
Return ""; /** * Convert PDF to SWF * @param softpath * @param sourcepath * @param destpath * @param fileName no real effect, no use of * @ return */public static Boolean pdf2swf (String Softpath, String SourcePath, String destpath, String fileName) {string
cmd = Softpath + SourcePath + "-o" + destpath + "-T 9";
SYSTEM.OUT.PRINTLN ("------Start PDF Conversion swf:" + sourcepath);
if (Stringutil.executecmdflash (cmd) = False) {System.out.println ("------conversion PDF Conversion SWF failure Error;cmd:::::" + cmd);
return false; }else{System.out.println ("Success;cmd:::::: "+ cmd";
} System.out.println ("------End PDF Conversion swf:" + sourcepath);
return true;
}
}