PDF Transfer SWF

Source: Internet
Author: User
Tags stringbuffer

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


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.