Use swftools to convert a PDF document to a SwF document 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 = runtime.getruntime(cmd.exe C (CMD); runtime. getruntime (). addshutdownhook (New thread () {public void run () {process. destroy () ;}}); inputstreamreader = new inputstreamreader (process. getindium Utstream (); 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);} 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:" + e, 2); Return false;} return true;}/*** get the file name, remove the suffix * @ Param file * @ return */public static string getfilename (string file) {If (file! = NULL & file. indexof (".")! =-1) {return file. substring (0, file. indexof (". ");} return" ";}/*** converts a PDF file to SwF * @ Param softpath * @ Param sourcepath * @ Param destpath * @ Param filename, * @ return */public static Boolean limit 2swf (string softpath, string sourcepath, string destpath, string filename) is not used) {string cmd = softpath + sourcepath + "-o" + destpath + "-T 9"; system. out. println ("------ start PDF conversion SWF:" + sourcepath); If (stringutil.exe cutew.flash (CMD) = false) {system. out. println ("------ error; cmd:" + cmd); Return false;} else {system. out. println ("success; cmd:" + cmd);} system. out. println ("------ end PDF conversion SWF:" + sourcepath); Return true ;}}