473,394 Members | 1,715 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Printing PDF directly from server...

I am using Process.Start() and pdfp.exe to launch Adobe Reader to
print PDFs directly from the server. My website's Application Pool
runs under a domain account and I am having trouble getting the
permissions right. It works when I add the domain account to the web
server's administrators group, but this isn't something I want to do
in production. Any ideas on how to give the domain account the
correct permissions without adding it to the Admins group? TIA ~
Matt ... Code follows...

public static void PrintPdfForm(System.Type builderType, string
inPath,
string outDir, DataSet formData, string printer) {

string outPath = outDir + Guid.NewGuid().ToString() + ".pdf";
IPdfFormBuilder builder;
try {
builder = Activator.CreateInstance(builderType) as
IPdfFormBuilder;
builder.BuildForm(inPath, outPath, formData);
string pdfpPath =
Mcrcsip.Amwa.PdfFormHandler.Properties.Settings.De fault.PdfpPath;
string args = "-p \"" + printer + "\" " + outPath;
RunExecutable(pdfpPath, args);
} catch (Exception ex) {
throw PdfFormException.GetException(
"Caught exception in
Mcrcsip.Amwa.PdfFormHandler.PrintPdfForm().", ex);
} finally {
if (System.IO.File.Exists(outPath)) {
try {
System.IO.File.Delete(outPath);
} catch (System.IO.IOException) {
}
}
}
}

private static void RunExecutable(string executable, string
arguments) {
ProcessStartInfo starter = new ProcessStartInfo(executable,
arguments);
starter.CreateNoWindow = true;
starter.RedirectStandardOutput = true;
starter.UseShellExecute = false;
Process process = new Process();
process.StartInfo = starter;
process.Start();
StringBuilder buffer = new StringBuilder();
using (StreamReader reader = process.StandardOutput) {
string line = reader.ReadLine();
while (line != null) {
buffer.Append(line);
buffer.Append(Environment.NewLine);
line = reader.ReadLine();
Thread.Sleep(100);
}
}
}

Feb 28 '07 #1
0 898

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Jody Gelowitz | last post by:
I am trying to find the definition of "Safe Printing" and cannot find out exactly what this entitles. The reason is that I am trying to print contents from a single textbox to no avail using the...
9
by: Jody Gelowitz | last post by:
I am trying to find the definition of "Safe Printing" and cannot find out exactly what this entitles. The reason is that I am trying to print contents from a single textbox to no avail using the...
9
by: Jody Gelowitz | last post by:
I am trying to find the definition of "Safe Printing" and cannot find out exactly what this entitles. The reason is that I am trying to print contents from a single textbox to no avail using the...
0
by: aleemkhan | last post by:
I am using SQL Server 2005 Local Reports for a web based project. The problem is that the ASP.NET default Web Report Viewer does not have print facility for Local Reports. When the report is...
18
by: Brett | last post by:
I have an ASP.NET page that displays work orders in a GridView. In that GridView is a checkbox column. When the user clicks a "Print" button, I create a report, using the .NET Framework printing...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.