Example #1: Use CmdAsUser.exe to run pptconv.exe from Administrator user account, Process proc = new Process(); proc.StartInfo.FileName = "C:\\test\\CmdAsUser.exe"; string strArguments = "Administrator . /p YourPassword /c C:\\test\\pptconv.exe C:\\test\\test.ppt C:\\test\\out.swf" Console.WriteLine(strArguments); proc.StartInfo.Arguments = @strArguments; proc.StartInfo.UseShellExecute = false ; proc.StartInfo.CreateNoWindow = true; proc.StartInfo.ErrorDialog = false; proc.StartInfo.RedirectStandardOutput = true; proc.StartInfo.RedirectStandardError = true; proc.Start(); proc.WaitForExit(); string output = proc.StandardOutput.ReadToEnd(); string error = proc.StandardError.ReadToEnd(); Remark: You may encounter Error 1314 in some Windows systems when you switch between user accounts, this is caused by permission setting, please by following steps to solve this 1314 Error, ERROR 1314: ~~~~~~~~~~~~~ 1314 A required privilege is not held by the client. ERROR_PRIVILEGE_NOT_HELD ~~~~~~~~~~~~~ To resolve this issue: 1. Click Start, click Run, type "secpol.msc", and then press ENTER. 2. Double-click "Local Policies". 3. Double-click "User Rights Assignment". 4. Double-click "Replace a process level token". 5. Click "Add", and then double-click the "Everyone" group 6. Click "OK". 7. You may have to logout or even reboot to have this change take effect. Please refer to following two screenshots to understand above steps, http://www.verydoc.com/images/err1314-1.png http://www.verydoc.com/images/err1314-2.png Please look at following page for the details about ERROR 1314, http://www.verydoc.com/exeshell.html Example #2: Use Free docPrint Service to run pptconv.exe from current active user account, Please download and install docPrint Service from following URL, http://www.verydoc.com/download/docPrint_Service.zip docPrint Service can be used to run a Command Line from current active user account or a special user account, this tool is useful to overcome permission restrictions in SYSTEM and Non-Interactive user accounts. Please by following steps to use docPrint Service, 1. Download docPrint_Service.zip and unzip it to a folder, 2. Run docPrint_Service.exe application, you will see an icon appear in tray area, 3. You can run following command lines to test it first, "docPrint_client.exe" will deliver the Command Line to docPrint_Service.exe application, docPrint_Service.exe application will execute the Command Line from active user account automatically, docPrint_client.exe nowait "C:\VeryDOC\pptconv.exe" C:\test.ppt C:\out.swf docPrint_client.exe wait "C:\VeryDOC\pptconv.exe" C:\test.ppt C:\out.swf 4. You can call "docPrint_client.exe" from your code, please refer to a simple C# code at below, using System; using System.IO; using System.Data; using System.Configuration; using System.Collections; using System.Collections.Generic; using System.Web; using System.Diagnostics; using System.Text; using System.Net; using System.Web.Security; using System.Web.UI; using System.Security.Cryptography; using System.Data.Sql; using System.Data.SqlClient; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Runtime.InteropServices; using Microsoft.Win32; public partial class _runpptexe : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { FileStream fs; TextWriter txt; Process proc = new Process(); proc.StartInfo.FileName = "C:\\ppttest\\VeryDOC\\docPrint\\docPrint_client.exe"; string strArguments = ""; strArguments += "wait C:\\ppttest\\VeryDOC\\pptconv.exe -$ XXXXXXXXXXXXXXXXXX C:\\ppttest\\test.ppt C:\\ppttest\\test.swf"; fs = new FileStream("C:\\pptcheck.txt", FileMode.Append, FileAccess.Write); txt = new StreamWriter(fs); txt.WriteLine("arguments"); txt.WriteLine(strArguments); txt.Close(); fs.Close(); Response.Write(proc.StartInfo.FileName); Response.Write(" "); Response.Write(strArguments); Response.Write("<br>"); proc.StartInfo.Arguments = @strArguments; proc.Start(); proc.WaitForExit(); Response.Write("File has been successfully converted.<br>"); } } Please look at following page for the details of Free docPrint Service, http://www.verydoc.com/exeshell.html Example #3: Use EXEShell COM Library to run pptconv.exe from an interactive user account, Please by following steps to try again, 1. Please download EXEShell COM Library from following URL, http://www.verydoc.com/download/exeshell.zip Please refer to following page about EXEShell COM Library, http://www.verydoc.com/exeshell.html 2. Please use following code to call pptconv.exe from PHP or ASP code, ASP code, <% Set comEXEShell = Server.CreateObject("exeshell.shell") comEXEShell.RunCommandLine "Administrator", "123456", "C:\pptconv.exe -$ XXXXXXXXXXXXXXXXXXX ""C:\in.ppt"" ""C:\out.swf""" Set comEXEShell = Nothing %> PHP code, <?php $PdfCreator =new COM("exeshell.shell") or die("Cannot start PdfCreator"); $PdfCreator->RunCommandLine("Administrator", "123456", "C:\pptconv.exe -$ XXXXXXXXXXXXXXXXXXX C:\in.ppt C:\out.swf"); $PdfCreator = null; ?> Please set correct username and password to RunCommandLine() function, then you can launch the conversion from this special user account. Remark: You may encounter Error 1314 in some Windows systems when you launch the conversion, please by following steps to solve the 1314 Error, ERROR 1314: ~~~~~~~~~~~~~ 1314 A required privilege is not held by the client. ERROR_PRIVILEGE_NOT_HELD ~~~~~~~~~~~~~ To resolve this issue: 1. Click Start, click Run, type "secpol.msc", and then press ENTER. 2. Double-click "Local Policies". 3. Double-click "User Rights Assignment". 4. Double-click "Replace a process level token". 5. Click "Add", and then double-click the "Everyone" group 6. Click "OK". 7. You may have to logout or even reboot to have this change take effect. Please refer to following two screenshots to understand above steps, http://www.verydoc.com/images/err1314-1.png http://www.verydoc.com/images/err1314-2.png Please look at following page for the details about ERROR 1314, http://www.verydoc.com/exeshell.html 3. OK, you should no problem to call pptconv.exe from ASP or PHP code now. Please notice, you need change "XXXXXXXXXXXXXXXXXXXX" to correct License Key which sent to you by us. Example #4: Batch convert MS PowerPoint documents to PDF and SWF files Please download and install PowerPoint Converter from following URL first, http://www.verydoc.com/verydoc_pptconverter.exe after you installed PowerPoint Converter product, please run following command lines to batch convert all of your PPT files to PDF or SWF files at one time, FOR /D %F IN (C:\TestFiles\*.ppt) DO "C:\Program Files\VeryDOC PowerPoint Converter v3.0\pptconv.exe" "%F" "%~nF.pdf" FOR /D %F IN (C:\TestFiles\*.ppt) DO "C:\Program Files\VeryDOC PowerPoint Converter v3.0\pptconv.exe" "%F" "%~nF.swf" If you wish include above command lines into a .bat file, you need use "%%" to replace "%" character, because "%" is a reserved keyword in .bat file, for example, FOR /D %%F IN (C:\TestFiles\*.ppt) DO "C:\Program Files\VeryDOC PowerPoint Converter v3.0\pptconv.exe" "%%F" "%%~nF.pdf" FOR /D %%F IN (C:\TestFiles\*.ppt) DO "C:\Program Files\VeryDOC PowerPoint Converter v3.0\pptconv.exe" "%%F" "%%~nF.swf" Above command lines will batch convert all of your PPT files to PDF or SWF files quickly. Example #5: Use cmdasuser.exe to run pptconv.exe by manual, C:\ppttest\VeryDOC\cmdasuser.exe Administrator . /p YourPassword /c "C:\ppttest\VeryDOC\pptconv.exe" "C:\ppttest\photo.ppt" "C:\ppttest\photo.swf" Click here to download PowerPoint Converter product. Click here to learn more for PowerPoint Converter...
VeryPDF.com |
VeryDOC.com |
VeryPCL.com |
Links | Contact
Copyright © 2002- VeryPDF.com, Inc. All rights reserved.
Send comments about this site to the webmaster.