Server side printing of PDF files over the network installed Printers - c#

Gone through the already existing posts on this topic, but my requirement is some what bit different.
Print jobs over the Network installed printers, upon a action in client side browser. Web server has got all printers in it, based on the client data, we need to print with client given configuration straight away, sending the job to printer(may be a different locations - but this is not a problem since the printers are in same network). I have seen printing architecture, Win32_print Class, SNMP, System.drawing.Printing, System.Printing.... but couldn't find the way to achieve this.. (Asp.net,C#)
-Files are been already existed in a server folder, just I need to pick up and send to a printer with client Selected Configuration...
update:I have to use JDF approach because all the files are PDF files. I am able to create JDF files with the selected configuration but sending this JDF to printer(JDF enabled) making me tough... There is JMF which post the JDF to printer, but not sure how to implement it.. still finding the ways, will be great if some one helps in this.

Something I can answer! 8-) I'm actually working on a project that uses this, right now.
Do not use Acrobat Reader as any sort of server application. It has a User Interface that will pop up on a screen that doesn't exist, at an unexpected time and freeze your app, waiting for a click that will never happen.
Use Ghostscript. Ghostscript is free, Open Source and will work perfectly for what you want. Out-of-the-box it consists of a DLL and a command line inhterface, however there is an API and a ton of different interfaces including .Net, and versions for both Windows and Linux.
On a more "overview" type of note, the reason you can drag a PDF into a printer on your workstation is because Acrobat Reader contains the code and hooks to allow this. Windows doesn't actually contain native functionality to print PDFs.

Related

Implementing Avery Monarch 9416XL printer into C# project

has anyone had any dealings with the above mentioned printer or one like it? I have been handed the task of introducing this printer into our c# project and am not sure where to start. I have created a sample .lbl file using Averys recommended software to get all of the dimensions correct. (Nicelabel SE)
the printer is connected to the PC via Network.
here is a Sample Image of the project that I am trying to create, I have spoken to one of the engineers at Monarch and he is helping me with creating a base file to send to the printer, and having some of the data as a variable.
ideally it would be good if I could launch a dos program which would handle this for me, but I seem to really be pulling at straws here.. I have seen the Zebra SDK, but im not sure if this printer is compatible.
Thanks.
I have spoken to the Guys from Avery and they built a template for me to use, and with a variable section in the code I was able to put in my own settings to get the required output.
To send the file to the printer I was able to use the LPR Service in windows using a batch file.

ASP.Net Print PDF directly to Printer With Preferences

I'm working on a project that requires us to send PDFs to a printing press. We've previously done this with a desktop app and Acrobat, but I'd like to switch to an ASP.Net app to give us more flexibility on what device the end user is using (there will likely only be one user at any given time).
Following something similar to this MS KB article is working well for sending the PDFs - the printer prints the documents, decent quality, etc.
The only issue I've found though, is that our files may require different printer configurations - e.g. one may need to be booklet folded, while the next may not.
Previously we had set these up in preconfigured drivers (i.e. "MyPrinter1" is set to booklet folded, "MyPrinter2" is not - both point to the same physical printer).
Sending the raw data, however, seems to ignore these. I'm assuming it's due to some header data not being included, or something similar; but I haven't found any info on how to include it.
I'm open to other methods. I've tried GhostScript, but it threw errors about the files. PDFSharp seems to work fine locally or while logged in to the web server, but doesn't do anything when logged out (not even an error message; assuming this is Adobe more than PDFSharp).
I'm potentially open to a paid option, but would (obviously) prefer free.
It's been a while and I forgot I had asked this question, but what we wound up doing was:
PdfView4Net (http://www.o2sol.com/pdfview4net/overview.htm) for opening the PDF and managing the print job.
Setting up default printing preferences for each configuration on the print server.
Making sure all printer configurations were installed for the same user as the service.

Using photoshop files from web application

I want to interact with a Photoshop file and create images using its actions and smart objects.
Is there any php or C# API to can do it?
First of all, I would like you to reflect on the legality of such a thing. Would Adobe let you practically just proxy their application to the web? I see they have a lot of licenses so maybe one of them actually grants you permission to do this (however, there could still be caveats so I suggest you read up on that). As that's not the question, I won't talk about this anymore, I just wanted to to mention it as it should be relevant.
Now, for the actual question - if you look at Microsoft Office Interop, Microsoft states that it is unsupported in a server-side environment. Go to this Microsoft page and read Problems using server-side Automation of Office in the More information section.
There are several issues if you decide to run a regular client application server-side, as stated on the mentioned page, but one of the most significant issues is the following:
Interactivity with the desktop:
Office applications assume that they are being run under an interactive desktop. In some circumstances, applications may need to be made visible for certain Automation functions to work correctly. If an unexpected error occurs, or if an unspecified parameter is needed to complete a function, Office is designed to prompt the user with a modal dialog box that asks the user what the user wants to do. A modal dialog box on a non-interactive desktop cannot be dismissed. Therefore, that thread stops responding (hangs) indefinitely. Although certain coding practices can help reduce the likelihood of this issue, these practices cannot prevent the issue entirely. This fact alone makes running Office Applications from a server-side environment risky and unsupported.
While this is written by Microsoft for their product, these are more or less applicable to any regular client application. And even if you still decided to go with this approach, as Neville K already suggested, it would be a very resource-hungry task.
Considering the above, I would maybe ask a different question, along the lines of "What library or server-side app to use for doing whatever you need to do with images".
Based on this link, you can do this things with Photoshop SDK:
"With the Photoshop SDK, you can enable your apps to drive and/or communicate with Photoshop CS6 (version 13.0.0 or later) via a TCP connection. It’s now possible to create an eBook of Photoshop tutorials that allows users to drive actions in Photoshop CS6 from within the eBook"
This sound like hard but some companies seems to make it work. Xee can read PSD too (and has an epic comment about this format in the source code).
But to quote someone over at HN:
PSD was never intended to be a data interchange format: it is the
serialization format of a single program that has more individual
unrelated features that actual people rely on than almost any other
piece of software and has maintained striking amounts of backwards
compatibility and almost unbroken forwards compatibility during its
over two decades of existence. This product's "file format" needs to
be critiqued in this context, along with similar mega-programs like
Office. I am thereby having a difficult time fathoming why anyone
would think that a PSD file is thereby going to be some well-organized
file format that they should easily be able to parse from their own
application is just naively wishful thinking: even other products
from Adobe have limitations while opening these files; to truly
manipulate these files you really need to be highly-compatible with
Photoshop's particular editing model (hence the conceptual
difference between these two classes of file format).
I would recommand to look at Xee for a server side utility.
Good luck.
You can use the scripting interface to kick off "Shell" tasks from any web language if you really want to.
However, I'd seriously worry about this approach - the memory requirements for Photoshop are such that you could only support a couple of users, and you'd need a fairly complex polling mechanism to check for the results of the "shell" task. Photoshop was simply not designed to power web sites in this way.
Consider using graphics libraries instead - I've used ImageMagick with great effect in the past.
Heed the warnings that you really can't process more than 1 or 2 images at a time with photoshop without crashing your server, so just putting it on your webserver is a non-starter. A lighter weight image library is much better for most tasks.
But you could queue up jobs from your web application and then process them on another computer, or limit it to just one at a time.
Adobe has macros and a full action/javascript based scripting environment that you could kick off from commandline or com.
Adobe Scripting Guide
http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/devnet/photoshop/pdfs/photoshop_cs5_scripting_guide.pdf
For older versions of photoshop you can use the macro functionality to Record an action. Then, create a droplet from the action. Call the droplet from the command line with an image file as the sole parameter. The path to the image file probably needs to be an absolute one.

How can i get the Printer details from server using c#

I need to create a C# application that will run in server in that i need to get the printer details like printer status, number of pages printed.The system which is requested for the print that systems username and system name.
If the system connected in the network requested for printing then i need to get the system details in my application
how can i do this?.
sorry for my bad English.
The classes in the .NET 3.0 System.Printing namespace are your starting point. Beware that the amount of functionality available is pretty limited. You can't get an event out of them that tells you that a new print job got started. Something as simple and obvious as counting printed pages is not possible.
This is a core architectural limitation, Windows leaves a lot of the printing management up to a the printer driver. And every printer manufacturer makes their own. Which explains that counting pages isn't supported for example, the driver sends some kind of proprietary control command to the printer to tell it to generate copies of a document rather than Windows spooling the same document repeatedly. That's efficient but not easily observed. These manufacturers also usually have their own printing management software, you probably ought to look at that first.

How can I print HTML files to a specified printer using shellexecute?

I have an application that has records that can have a number of attachments associated to them, which may be a collection of JPG, TIF, PDF or HTM files (theoretically this list is arbitrary, and these are the most typical types).
One of the actions I need to be able to do is to allow these to be printed en mass to a specific printer.
For most file types, I can emulate the shell and perform the same action as had they dragged the file and dropped it onto a printer in explorer, by using the "PrintTo" verb, and using ShellExecute (via ProcessStartInfo); however, I've been scratching my head for a while wondering why this wasn't working for HTM files - instead it always prompts to select a printer for each file, even though the registry settings appear to be there for it.
It is when I went back to first principles, and checked to see if the shell behaves "properly" when I discovered that it behaves the same way (so, lets say you drag and drop any old HTML file onto a printer in explorer, it always prompts to print, defaulting the printer to be your default printer, even if that isn't the printer you dropped the file onto)
Now, it appears this behaviour was introduced in IE7 (whether intentionally, or not, I'm unsure); but is there any way of getting this to work as expected?
EDIT: This is for an internal application, so it would be permissible to fix up the registry if that would work.
You could use the webbrowser control and call the .Print() method. I just tested it and it went right to my default printer without prompting me. I know that might not be ideal, but I think it should get the job done.

Categories

Resources