How do I use DocPub CLI on an ASP.NET server

43 views
Skip to first unread message

Kevin Kuo

unread,
Jan 29, 2014, 1:39:42 PM1/29/14
to pdfnet-w...@googlegroups.com
Q: How do I use the DocPub CLI executable on an ASP.NET server? 

==========================================================

A: You can run DocPub on an ASP.NET server just like any other executable.

This C# code snippet can be used in a controller:

System.Diagnostics.Process process1 = new System.Diagnostics.Process();
process1.StartInfo.FileName = @"C:\Users\PDFTron\Documents\visual studio 2010\Projects\MvcApplication2\MvcApplication2\bin\docpub32.exe"; //path to docpub executable
process1.StartInfo.WorkingDirectory = @"C:\Users\PDFTron\Documents\visual studio 2010\Projects\MvcApplication2\MvcApplication2\bin\"; //directory of pdf file
process1.StartInfo.Arguments = "-f xod document.pdf"; //docpub arguments
process1.StartInfo.UseShellExecute = false;
process1.StartInfo.RedirectStandardOutput = true;
process1.Start();

//wait for the process to finish
process1.WaitForExit();
//print out the CLI output for debugging
StreamReader myStreamReader = process1.StandardOutput;
String stdOut = myStreamReader.ReadToEnd();
System.Diagnostics.Debug.WriteLine(stdOut);
process1.Close();


If you need more PDF features (manipulation, flattening, optimizing etc.), PDFNet SDK for .NET is also available for ASP.NET.

 


Reply all
Reply to author
Forward
0 new messages