欢迎来到Doc100.Net免费学习资源知识分享平台!
您的位置:首页 > 程序异常 >

asp.net 或者c#net 中用flashprinter将pdf转换成swf的有关问题

更新时间: 2014-01-05 01:50:17 责任编辑: Author_N1

 

asp.net 或者C#.net 中用flashprinter将pdf转换成SWF的问题
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Diagnostics;using System.Drawing;using System.IO;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows.Forms;namespace WindowsFormsApplication1{    public partial class Form1 : Form    {        public Form1()        {            InitializeComponent();        }        private void Form1_Load(object sender, EventArgs e)        {            ConvertPdfToSwf(@"pdf\2010xrss.pdf", @"swf\temp.swf");            convertPDFToSwf(@"pdf\2010xrss.pdf", @"swf\temp.swf");            ConvertPdfToSwf(@"pdf\2010xrss.pdf", @"swf\temp.swf");        }        public void ConvertPdfToSwf(string inFilename, string swfFilename)        {            try            {                string flashPrinter = string.Concat(AppDomain.CurrentDomain.BaseDirectory, @"FlashPaper2.2\FlashPrinter.exe");                ProcessStartInfo startInfo = new ProcessStartInfo(flashPrinter);                startInfo.Arguments = string.Concat(AppDomain.CurrentDomain.BaseDirectory + inFilename, " -o ", AppDomain.CurrentDomain.BaseDirectory+swfFilename);                Process process = new Process();                process.StartInfo = startInfo;                bool isStart = process.Start();                process.WaitForExit();                process.Close();            }            catch (Exception ex)            {                            }        }        public static void convertPDFToSwf(string PDFPath, string SWFPath)        {            string exe = string.Concat(AppDomain.CurrentDomain.BaseDirectory, @"FlashPaper2.2\FlashPrinter.exe");            if (!File.Exists(exe))            {                throw new ApplicationException("Can not find: " + exe);            }            System.Diagnostics.Process proc = new System.Diagnostics.Process();            proc.StartInfo.FileName = exe;            proc.StartInfo.Arguments = " -o \"" + SWFPath + "\"" + " -z" + " -s flashversion=9" + " -s disablelinks" + " -j 100" + " \"" + PDFPath + "\"";            proc.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;            proc.Start();            proc.WaitForExit();            proc.Close();        }        public static void ConvertToSwf(string pdfPath, string swfPath)        {            try            {                //string exe = HttpContext.Current.Server.MapPath("PDF2SWF/pdf2swf.exe");                //string exe = @"d:\SWFTools\pdf2swf.exe ";                string exe = string.Concat(AppDomain.CurrentDomain.BaseDirectory, @"FlashPaper2.2\FlashPrinter.exe");                if (!File.Exists(exe))                {                    throw new ApplicationException("Can not find: " + exe);                }                StringBuilder sb = new StringBuilder();                sb.Append(" -o \"" + swfPath + "\"");//output                   sb.Append(" -z");                sb.Append(" -s flashversion=9");//flash version                   sb.Append(" -s disablelinks");//禁止PDF里面的链接                   //sb.Append(" -p " + "1" + "-" + page);//page range                   //sb.Append();//Set quality of embedded jpeg pictures to quality. 0 is worst (small), 100 is best (big). (default:85)                   sb.Append(" \"" + pdfPath + "\"");//input                   System.Diagnostics.Process proc = new System.Diagnostics.Process();                proc.StartInfo.FileName = exe;                proc.StartInfo.Arguments = sb.ToString();                proc.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;                proc.Start();                proc.WaitForExit();                proc.Close();            }            catch (Exception ex)            {                throw ex;            }        }    }}
上一篇:上一篇
下一篇:下一篇

 

随机推荐程序问答结果

 

 

如对文章有任何疑问请提交到问题反馈,或者您对内容不满意,请您反馈给我们DOC100.NET论坛发贴求解。
DOC100.NET资源网,机器学习分类整理更新日期::2014-01-05 01:50:17
如需转载,请注明文章出处和来源网址:http://www.doc100.net/bugs/t/1806/
本文WWW.DOC100.NET DOC100.NET版权所有。