Printing Server Side from .Net (without WinForms) - c#

Hey printing junkies need some pointers to send me in the right direction for this development.
I am developing an epos system for a local shop which we are later going to tie into an ecommerce site.
The front end of the epos system is going to be WinForms so we can handle USB devices easily and we are going to use a WebForms/MVC admin console.
One area we are inexperienced in is printing. We need to print barcodes, and wish to do this via the admin console (web based).
So (finally) the question. Where do we start looking for code that will allow us to print directly to a connected printer from the server (IIS) instance of .net from the webforms.

System.Drawing.Printing
http://msdn.microsoft.com/en-us/library/system.drawing.printing.aspx
Creating the document is a lot like creating a dynamic image. I have not actually sent a document to the printer from a web app, but I don't see why you couldn't.

Your Web app will probably have to use remoting to connect to a Windows service running on the same machine (or pick your favorite IPC mechanism—perhaps a queue in a database). This service can run in an full trust context and should be able to print for you.

You can set up a local printer, that just passed traffic through to the network printer. This is easier to set up that printing direct to a network printer. See link text

Related

how to access usb port of client pc from web app

I have a web app. now I want to add "present and absent by finger print" to this. everything work fine in localhost (add finger,remove finger and etc). I send device port name to functions to do jobs.
but after publishing project I recognized that it can not find port in client's pc.
now I want to now how can I access specific port in client's pc after publishing web app?
PS:if you need to know part of code just say it to show you, thank you
Browsers don't let you to do it on purpose. However, you can create ActiveX objects, plugins or browser extensions to do it.
For example you can check this
I have understand the best way is windows application, so I did my job by creating c# windows application and did my job as well as I wanted.

ASP.NET Web service generate DUPLICATE print jobs

I am develop a ASP.NET (SOAP) web service for print KOT/BOT print outs . I am using "PrintDocument" class for handle print jobs and the printer is Epson TM U220 network printer. The problem is when calling the print web method sometimes its generate DUPLICATE print outs. But according to my system logs, from the web method call print function only onetime, but from the Printer (Epson TM U220) generate same print out twice. Also this not happening every time. We are also unable figure out in which point this issue is occur.
Also this problem not occurring in our office testing environment. This happening our one client site only. Customer complain time to time, system generate DUPLICATE KOT/BOT printouts. And also their not using dedicated server PC for the IIS server and SQL server database. Their using standard shared PC for system. So is this a problem of the web service, IIS server or the Hardware (System PC or LAN Network communication between PC and the Printer)?
By the way is this AutoCutter or not? Epson has a "Serial emulation driver" that makes a USB printer act like it's on a real serial port. Then you can use direct-to-port in Campground Master, set up as a serial printer and test it whether its keep hapenning duplicate printing. but you might need to use service to talk to port in the destination computer (local port printing) we did sometime when we had simillar issue.May be this help to you

How to print PDF directly to printer with C#

How can I print PDF directly to a printer with (asp.net) C#?
I actually want to print the PDF directly without showing a dialog on the server side in asp.net c#
You'll be hard pressed to make this from asp.net if the server isn't residing in the same LAN as the client and can have the same printers installed, this due to security functions inside the web browsers not allowing websites to print to a local machine. You might get a solution for this if you implement some ActiveX Component or Java applet to run this (even seen it in Silverlight, but that's going away).
Something like http://www.vbgold.com/index.shtml#AdvancedPDFPrinter might help you achieve what you're looking for.

view the GUI of a .net application on remote pc (no remote desktop or vnc etc.)

I read several articles but didn't get an understanding regarding WCF (or remoting or ...).
I have written a .NET 4.0 WinForms application running on one PC where a user is making inputs.
I would like to display the GUI of the application on a second PC.
No inputs on the second PC, just viewing the application.
How might this be possible? (WCF or no WCF?)
(controlling the whole PC with remote desktop or vnc is no option)
Thanks a lot for any suggestions,
Ralf
You could make the main application expose a WCF service and have a second view application consume the service to view the data.
If viewing the area of the screen the application resides in is an option, my library RemoteViewing may be sufficient for you.
The included example server (it includes both client and server VNC) is read-only.
In the example server, instead of passing a Screen as a second argument to VncScreenFramebufferSource's constructor (that will capture the entire screen), provide a callback to the screen rectangle containing the application. That should be all you need.

How to properly execute C# file over local network?

Overview
C# File - Users PC
PHP Server - Hosts Webpages for application
Server and Users PC on local network
I have a c# file that reads weight from a USB scale. How would I trigger this file to run so it feeds into my program. The problem is I am using PHP to host our webpage/application so its not running client side and the scale is not hooked up to the server but to the clients PC.
The C# script would have to be on the clients in order to read the scale so how would I trigger this to happen?
Is this even possible and if not what would be a better way?
Important Edit
I was able to run the Scale Script (C#) when I wanted by having PHP and C# use TCP sockets.
The C# would listen for PHP to send something and when it did it would read the scale and send this information back to PHP becuase PHP was listening for a response. Mixed in with a little Ajax and it updates in the web browser.
Gave Chris Credit because he was the most helpful with answering my questions
It sounds like what you really want is for the client application to submit the data to the website itself, and the most suitable approach is probably to expose a web service from your server.
This service should accept weight data, along with some sort of customer key or whatever, to correlate the records correctly on the server side. I've never created a web service in PHP personally, so I can't give any advice on the implementation of that, but it is fairly trivial to hook a C# client app up to a web service once you've exposed its metadata (assuming you use SOAP).
you can't start C# application from a web page in a way that'll work in every browser every time. BUT, you can have some workarounds:
Use ActiveX component that read the data in the client and upload it to the server. the biggest cons is that it'll only work in Internet Explorer
use Silverlight client application that runs on elevated mode (v4) and upload the data to your server.
refer your clients to download application (the C# application you wrote about) and run it - this application will upload the data to your server.
hope this helps.
C# isn't a scripting language, it's a language that compiles into executable binaries or libraries. You won't be able to execute C# code on the client's computer via a website because C# code needs to be compiled before it can run.
Presumably what you really want is for your compiled C# binary to be executed on the client's machine via your website. You won't be able to easily do that. There are a lot of security measures in place to prevent browsers from running programs on your computer. There may be ways to hack around these security measures by using plugins (such as ActiveX), but it's not something that will be a one-liner.
Edit: I think you need to step back and think about what you're trying to do in a broad sense. You're trying to create a website that can read information from a user's USB port. This is the type of thing that browsers are designed to prevent, and for good reason. I wouldn't want random websites to be able to access peripheral hardware without my explicit permission. If you want this website to function the way you're expecting, you're going to have to seriously think about the security implications. You'll need some kind of client-side code (ActiveX, Silverlight, ...), and the user will need to explicitly give permission to for this all to happen. It won't be easy, and it won't be automatic. And I'm damn glad that's true.

Categories

Resources