Format a printing document over the web
printing solutions over our web applications using Html's is not trivial. Its getting harder when we need to calculate the printing output number of pages and when we need to add an header and footer in each page at the exact position.
Products:
There are tools and products that come overcome these kind of problems like Microsoft Reporting Server and other.
One of those tools I saw few weeks ago in one of our customers office - and I was really impressed. The printing implementation was done using the product and printing library of MeadCo company. In order to display a printing preview from the web application they are using a print preview ActiveX that do the work.
They also implement a print server as window application that gets request from the web users, queue the printing jobs and handle it by creating a file for printing and even send it to the requestor user by sending the file to the user network printer.
[I raise the above solution only because I saw it working and I like what I saw.]
As I mentioned I was impressed from the solution.
Using Office2000/2/3 Html pages:
Another great solution for handling printing over the web is a solution I used two weeks ago for one of our company customer. The solution is base on Office2000 or higher version. I created my report as MS Word document and then save it as Html file. Office client created the Html file and puts additional element in a doc_files folder. The elements include the document images. header.htm file which as its name indicate responsible for the header and footer display and an Xml that points to the additional files in the folder.
I took the Html that I saved and convert it to ASPX file and then I added my code that retrieve the report data. There are few things to do in order to get the expected result like changing the ContentType Http header of the ASPX to MS Word application but because the intend of this post is only to raise the options I will not drill down further.
Its fairly simple but still yield good result
Using Office System Xml file:
I know that as part of office system (version 11) we can create a word document and save it as Xml. Then we can take this Xml and replace the data element values with the data from our application at run time. The Xml then will be open by Office System client in the desire format and layout and the user will be able to take another step and print it.
Things get simple using this solution.
My Conclusion is like always - know your options.