Click here to Skip to main content
12,501,452 members (51,337 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# DLL printing file
I need to print my Files found in my SPFolder directly to the Printer without recognizing the file type, so which Windows API to call and how to call it ? Also what's the process to launch the printing job when there are many files to print at the same time ?
Posted 16-Oct-12 6:18am
GLolita494
Comments
Sergey Alexandrovich Kryukov 16-Oct-12 13:00pm
   
What makes you think that you really need it?
--SA
GLolita 16-Oct-12 13:02pm
   
since my application will retrieve the docs from the server and will send those files to the client side where the printing operation wil take place, I thought since I'm on the server side and I have no idea about the printer I should be using low level printing services of gdi32.dll and winspool.drv
Sergey Alexandrovich Kryukov 16-Oct-12 13:04pm
   
Just wrong motivation. It cannot really help you, but .NET printing will work.
--SA
Richard MacCutchan 16-Oct-12 14:44pm
   
You cannot do it without recognising the file type as you will have no idea what to send to the printer. Some file types will have a registered print option in their file type set in the shell so you could try that, but you are still relying on the user setup. And you will still need the user to select the actual printer for each file.
Sergey Alexandrovich Kryukov 16-Oct-12 17:17pm
   
It's a good point.
--SA
GLolita 17-Oct-12 4:46am
   
well this article gave me the idea http://www.c-sharpcorner.com/UploadFile/johnodonell/PrintingDirectlytothePrinter11222005001207AM/PrintingDirectlytothePrinter.aspx
Sergey Alexandrovich Kryukov 17-Oct-12 13:28pm
   
Well, some article give the idea to commit suicide, but will you follow the directions?
I'm telling you: use pure .NET printing and stop thinking about anything else, which won't help you by the reasons I tried list. If you need help, ask some follow-up questions. If you are agree, accept my solution formally (green button).
--SA
GLolita 18-Oct-12 5:21am
   
thanks for the solution , but here's my problem now can .NET process do printing in a silent mode? meaning : yes I want to print my files but I wanna do it discretely without opening them first , not even hidden windows display! so any idea for that ?
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

If you use C#, printing directly with Win32 API would be 1) awkward, hard to implement, 2) not platform-portable (in contrast to using CLI and .NET FCL — you would be able to run your code on a number non-Microsoft platforms). I see no situations where you can get any benefits of it. As most members also don't like waste their time on something which does not make sense or not really useful, you will need to provide a convincing motivation of what you want, but I don't think you can succeed.

—SA
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

Hello,

You can use spooler API. This articles helps you:

http://support.microsoft.com/kb/322091/en-us[^]
http://support.microsoft.com/kb/138594/en-us[^]

Regards,
Maxim.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web01 | 2.8.160919.1 | Last Updated 18 Oct 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100