views:

46

answers:

1

Hello everyone,

I'm developing a web application which processes invoices(the functionality is not limited to invoices, but it doesn't matter). One of the parts of the workflow is to print invoice after it was published. This means that the website user is able to select 10-20(and more) invoices and print it at once. Also there may be several invoice templates which may be customizable(this is one of the key requirements).

I should also mention that we decide to generate PDFs from the html code and then print it. So as the PDF creation process may take some time to complete we decided to use a windows service for invoices printing.

So, summarizing we have the following requirements:

  1. There should be customizable invoice templates;
  2. The website user should be able to specify which template he want to use with the invoice item specified;
  3. There should be a possibility to print one or several selected invoices in one click.

Our first idea was to use user controls as invoice templates. The user control will be responsible for invoice layout. This also means there will be a base class for these user controls through which we will be able to define a data source for the controls. In this case we may even allow users to modify ascx file (or something similar) to edit basic captions if necessary.

The problem begins in the windows service where we are unable to generate output for user controls. So the other solution is to use http handler or web service to generate user controls output and transfer this to the windows service. But this complicates the solution (e.g. we need to use authentication for this and similar problems).

Maybe there is a much more simpler way to do it?

Thanks in advance.

+1  A: 

In response to your comment, I suggest you have the website generate the HTML and save it into a 'GeneratedInvoice' field in your DB, which the service then processes (i.e. converts to PDF however your pdf conversion software does it). It's appropriate because you have a 'saved' copy of the generated invoice; i.e. if your invoice processing routine changes (different styles, etc) your old invoices aren't affected, and yet you can regenerate a given bunch in a possibly 'new' format if required.

Noon Silk
Thanks! This is much better then initial solution proposed by me.
Alex