Convert PDF to SwF

Source: Internet
Author: User

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 ;}}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.