日期:2014-05-16  浏览次数:20979 次

asp下如何实现PDF、DOC或PPT转SWF实现在线浏览?
在IIS中我已经设置以超级用户administartor运行网站

其中测试了FlashPrinter和SWFTools始终没有成功,是不是我哪儿有问题?

FlashPrinter代码如下:

<%
RunPdfPath = "D:\wwwroot\ziliao\a.pdf"
RunSwfPath = "D:\wwwroot\ziliao\b.swf"
strCmd = "C:\FlashPaper\FlashPrinter.exe  "&RunPdfPath&" -o "&RunSwfPath&"" 
Set Shell = Server.CreateObject("WScript.Shell")
Runcode = Shell.Run(strCmd,0,True)
Set Shell=Nothing

Response.Write strCmd
If Not isempty(Runcode) And Runcode=0 Then 
   Response.Write("操作成功执行<br>") 
ElseIf Not isempty(Runcode) Then 
   Response.Write("操作执行失败<br>")
Else
End If
%>

SWFTools测试代码如下:

<% 
Dim strpdfFile        ' pdf的文件名 
Dim strswfFile        ' swf的文件名 
Dim strCmd            ' 命令行   
strpdfFile = "D:\wwwroot\a.pdf"  
strswfFile = "D:\wwwroot\m.swf" 
'命令行
strCmd = "C:\Program Files\SWFTools\pdf2swf "&strpdfFile&" -o "&strswfFile&" -T 9 -f -s languagedir=C:\Program Files\SWFTools\xpdf\xpdf-

chinese-simplified"  
'执行命令行   
Dim objShell   
Dim intSecceed   
Set objShell = Server.CreateObject("WScript.Shell")   
Response.Write(strCmd & "<hr>")   
intSecceed = objShell.Run(strCmd,0,True)   
If intSecceed = 0 Then  
    Response.Write("命令成功执行,返回码:" & intSecceed)   
Else  
    Response.Write("命令执行失败,返回码:" & intSecceed)   
End If  
%> 

我把代码中对应命令手动输入到CMD中运行测试没有任何问题,但ASP运行就提示失败该咋办呢?
------解决方案--------------------
在asp中调用cmd不是好方法。
最好是写一个服务,asp只是用来上传文件。用服务去监控目录并去转换文档。
------
http://www.print2flash.com/  print2flash提供了COM组件来转换,在线转换毕竟还是占资源的。
------解决方案--------------------
楼上正确。或使用ActiveX来实现。