protected void Button1_Click(object sender, EventArgs e)
{
bool isconvert = ConvertPdfToSwf("creport\\0903161110-远程.doc", "creport\\AS.SWF");
if (isconvert == true)
Response.Write("ok");
else
Response.Write("no");
}
public bool ConvertPdfToSwf(string inFilename, string swfFilename)
{
bool isStart;
try
{
string flashPrinter = string.Concat(AppDomain.CurrentDomain.BaseDirectory, "Macromedia\\FlashPaper 2\\FlashPrinter.exe");//FlashPrinter.exe
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo(flashPrinter);
startInfo.Arguments = string.Concat(Server.MapPath(inFilename), " -o ", Server.MapPath(swfFilename));
System.Diagnostics.Process process = new System.Diagnostics.Process();
process.StartInfo = startInfo;
isStart = process.Start();
process.WaitForExit();
process.Close();
}
catch (Exception ex)
{
throw ex;
}
return isStart;
}
这是从网上找来的一些,但是不完整,也不能转换.求解.或给个全新的解决方案
{
bool isconvert = ConvertPdfToSwf("creport\\0903161110-远程.doc", "creport\\AS.SWF");
if (isconvert == true)
Response.Write("ok");
else
Response.Write("no");
}
public bool ConvertPdfToSwf(string inFilename, string swfFilename)
{
bool isStart;
try
{
string flashPrinter = string.Concat(AppDomain.CurrentDomain.BaseDirectory, "Macromedia\\FlashPaper 2\\FlashPrinter.exe");//FlashPrinter.exe
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo(flashPrinter);
startInfo.Arguments = string.Concat(Server.MapPath(inFilename), " -o ", Server.MapPath(swfFilename));
System.Diagnostics.Process process = new System.Diagnostics.Process();
process.StartInfo = startInfo;
isStart = process.Start();
process.WaitForExit();
process.Close();
}
catch (Exception ex)
{
throw ex;
}
return isStart;
}
这是从网上找来的一些,但是不完整,也不能转换.求解.或给个全新的解决方案
看這裡
{
string filename = Session["filename"].ToString();
string fileexte = Session["fileexte"].ToString();
string file = filename + fileexte; Process p = new Process(); p.StartInfo.FileName = @"C:\Documents and Settings\Administrator\桌面\FlashPaper2.2\FlashPrinter.exe";
//p.StartInfo.FileName = @"E:\软件\FlashPaper2.2\FlashPrinter.exe";
p.StartInfo.Arguments = string.Format("{0} -o {1}", Server.MapPath("files/") + file, Server.MapPath("swf/") + filename + ".swf");
p.StartInfo.UseShellExecute = false; p.StartInfo.RedirectStandardInput = true; p.StartInfo.RedirectStandardOutput = true; p.StartInfo.RedirectStandardError = true; p.StartInfo.CreateNoWindow = true; p.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; p.Start();
p.WaitForExit();
p.Close();
p.Dispose(); System.Threading.Thread.Sleep(1000);
path = filename + ".swf";
Session["path"] = path;
Button2.Enabled = true;
}
catch
{
}