Hi All
How can i print a pdf without previewing it.
Thanks in advance
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Suthish NairRank #92 · 22.8K reputationPosted Mar 16, 2011, 5:59 AM EDT
Nivedita72 reputationPosted Mar 16, 2011, 6:01 AM EDT
Mahesh ChandRank #1 · 393.3K reputationPosted Mar 16, 2011, 7:51 AM EDT
Nivedita72 reputationPosted Mar 16, 2011, 10:01 PM EDT
The pdf document to be printed is stored in the application directory only ...and I need to print it programmatically.
Thanks
Suthish NairRank #92 · 22.8K reputationPosted Mar 17, 2011, 8:42 AM EDT
Mahesh ChandRank #1 · 393.3K reputationPosted Mar 17, 2011, 8:51 AM EDT
There is no direct way to print a PDF from C#. You can either launch the Adobe and then use its print feature.
BUT if you MUST print without launching the Adobe reader, I suggest you look into a third-party library such as DynamicPDF or ExpertPDF. These APIs allow you to read, print, edit etc in PDF documents.
Mahesh ChandRank #1 · 393.3K reputationPosted Mar 17, 2011, 8:52 AM EDT
http://www.dynamicpdf.com/Dot_NET_Dynamic_PDF_Components_Libraries_PrintManager.csp
Nivedita72 reputationPosted Mar 17, 2011, 9:24 PM EDT
Thanks for the reply, I searched and found out the same. But this time I was able to print document while it was on my D drive,when I tried printing the document after including it in the solution, it threw an exception saying "file could not be found. and so can not be opened". The document is stored in a folder named "Document" and the code is
Here I am reading the file path
string path = "/Document/filename.PDF";
System.Diagnostics.ProcessStartInfo startInfo = new
System.Diagnostics.ProcessStartInfo();
startInfo.Arguments = " /t \"" + path + "\" \"" + printerName + "\"";
startInfo.FileName = @"C:\Program Files (x86)\Adobe\Reader 10.0\Reader\\acrord32.exe";
startInfo.CreateNoWindow = false;
startInfo.UseShellExecute = true;
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
System.Diagnostics.Process process = System.Diagnostics.Process.Start(startInfo);
process.WaitForExit(30000);
if (process.HasExited == false)
{
process.Kill();
}
Thanks in advance
krishna kumar dubey71 reputationPosted May 2, 2011, 11:00 PM EDT
Soft CornerRank #1,221 · 1.5K reputationPosted May 2, 2011, 11:05 PM EDT
this thread is old , Posted on: 16 Mar 2011
Thanks
Hirendra SisodiyaRank #258 · 9.8K reputationPosted May 2, 2011, 11:35 PM EDT
i think posted date should not be an issue...
thanks