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.
Related
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.
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.
On my companies intranet, the business had asked to allow the users to deposit a file into a shared folder for it to be auto-posted to the intranet site. Pretty much the same as a file upload, with direct access to the storage device on a different server (with filetype limitations).
Since I don't have any control over the users and their knowledge of Section 508 compliance, is there a method to valid the document prior to it being added to the page? Right now, I have a C# class that builds a list from approved folders within that directory. I just want to make sure that if the files are not accessible, that they do not get added to the list.
I am sorry to say that Chris is incorrect in his answer. Section 508 applies to all file types, not just applications. There is a scanner by HiSoftware called Compliance Sheriff, that might work, but it may break due to how big your site is. My recommendation is to train people to make files compliant.
If you want the files to be truly accessible, then no machine algoritm will do. A story from my previous workplace:
Content editors for a site were asked to enter in a picture's caption (placed below an image, for all to see), and the alt text (for screen-readers). One ended up entering the same text in for the alt text as they did for the caption. As a result, a 508 scan did pass, but an actual 508 evaluation by a human did not.
We had a similar problem as you, with files placed on our CMS. Our customer and her cadre of lawyers ultimately decided that it was not up to the IT staff to determine 508: it was the publisher of the file. If someone wanted to upload a PDF or PPT or Word doc, they had to ensure it was 508 compliant FIRST. We, the code monkeys, were not to take on the risk.
Whenever someone was going to upload a file, we'd warn them about compliance, and offer them a contact for making their files 508 compliant (we had an in-house group for that). We also offered a way for users to flag non-508 files so we could pull them down quickly and get them updated.
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.
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.