This deserves to be a *post*, not a comment. Recycling the bits.

We all know that Erika is responsive when you leave comments on her blog. This is one of the case where she responded to a comment on her post. When I was going through her blog I saw the comment below and said..OMG..this *deserves* to be a post! So, doing the needful (yea.."Indian English" :)).

(edited one paragraph because ..you know it ! come on!)

 

Printing server-side is an interesting problem so I will have split my answer since there's two things to consider.

Software - hardware?

Proposing a server-side printing software solution goes hand-in-hand with the hardware infrastructure that the company has. Printing is probably the slowest thing to do in computer land. Say you have a top end printer, you will be able to print at most 50 pages/minute. If you were to print 1,000 documents of 10 pages each, the operation would take you 200 minutes. The least thing that should worry you (considering the times and resources involved to print) is using COM automation. By the time the printer prints the documents, Word automation will be done. Some banks have printers connected in a network to do load balancing, problem is print spoolers have a limited memory, so you would also need some program to enqueue (some kind of hard disk spooler program) documents. I know some banks use special hardware and software to handle massive printing. Some of this programs either print text files (use a driver to print in certifiers) or translate documents and generate a graphic (in memory) and send to the printer (most solutions involving pdf files use this approach). This programs also take care of the document queueing process.

Printing Word documents...

To print Word documents you need to run Word. Only Word understands it's formatting tags. Every single format (bold, underline, colors, spaces, fonts) that you see on the screen are rendered by Word and the same happens with a printer. So the only program that will print you a WYSIWYG Word document is Word. I know it's not recommended to use server-side automation, but at this point, it's your best shot.

Now, there's an option. It IS possible to go the XPS way with the only problem that you would need to write some kind of parser that reads the WordML formatting elements and transform documents to XPS format (it's also XML). I don't know of any code sample to do this, but if you were to build this solution, probably the Windows SDK documentation can help:

https://windowssdk.msdn.microsoft.com/en-us/library/ms771525.aspx

I know there are some code samples (including printing XPS documents) that you can download here:

https://www.microsoft.com/downloads/details.aspx?FamilyID=ea97a39d-6812-4904-8226-85f3da99996b&displaylang=en

You will find information of every single element for WordML here:

https://www.ecma-international.org/news/TC45_current_work/TC45-2006-50_final_draft.htm

There are some translator applications that convert WordML to something else, for example:

https://openxmldeveloper.org/articles/OpenXMLtoXHTMLinJava.aspx

Finally, there are more great samples for manipulating WordML here:

https://openxmldeveloper.org/archive/category/1003.aspx

Erika I am sorry for striking out the content, but I am in support and I really really know..what happens when you try to do a server side automation.

Trust me..whenever its a "best shot"..its towards yourself !

 

del.icio.us tags: Server Side Automation, Office development, Open XML, Pranav Wagh, Microsoft Blogger

Technorati tags: Server Side Automation, Office development, Open XML, Pranav Wagh, Microsoft Blogger