0

I am thoroughly confused with something I want to do and am looking for some advice.

One of my client has to produce monthly invoice detailing all of the company expenditure, and two other such invoices. The client is sure that he only needs these invoices - and they are extremely simple enough to produce as far as logic is concerned.

Now, to make the actual invoice, I don't really want to use reporting solutions like Telerik, SSRS etc.. as I think they are an overkill for my purpose. At the same time, I am not sure how I can get the printer to print the invoices in a neat pages without cutting off anything.

I am very tempted to just give the output in a webpage and ask my client to print them off from there.

Am I not looking at this the right way? Is this possible?

I could use ITextSharp or something to produce pdf's.. In fact, I think I will go ahead with this if it isn't possible to just output to html page and get the printer to recognize the page breaks somehow.

Because this is a very small job, I don't want to spend too much time on it as the cost of this freelance project is minimal too.


The reason printing to a new page is important is that my client has a few shops he deals with and he would want to print each of his customers their own invoices. I can get him to produce each customer's invoice separately and print them but it is not ideal way to deal with it.

thanks

LocustHorde
  • 6,361
  • 16
  • 65
  • 94
  • is this webforms or MVC? – Malcolm O'Hare Dec 10 '12 at 14:57
  • @MalcolmO'Hare - asp.net web forms. – LocustHorde Dec 10 '12 at 14:58
  • My opinion is that SSRS (or probably Telerik) would handle everything you're worried about, and aren't really THAT hard to set up. I guess if you don't know those technologies already there's the learning curve to worry about. – CodeRedick Dec 10 '12 at 14:59
  • I'm not sure how easy it is to output a webform to Pdf (in MVC its simple), but that would be my recommendation. – Malcolm O'Hare Dec 10 '12 at 15:04
  • 1
    Saying SSRS is overkill but you are considering using iTextSharp is like saying that building your house extension out of bricks and mortar is overkill so instead you are going to set off a nuclear explosion that flattens the entire town, wait 400,000 years for the radioation to die down and rebuild the whole thing from scratch. Creating an SSRS report to do what you need would take an hours or 2 at most, writing code to do the same thing in iTextSharp is a load of work – Ben Robinson Dec 10 '12 at 15:10
  • @BenRobinson, hahaha, well.. I have no idea about reporting services so I assumed it was a big thing (w.r.t time it takes to build and add to it the learning curve) but pdf.. I have worked with it before.. it is a big mess, but I can do it once and forget about it.. though you are right, it will take (a lot of) some time to build it.. – LocustHorde Dec 10 '12 at 15:28
  • SSRS has a drag and drop interface for designing reports and has a PDF output option. If the data is in a SQL server database then even with the learning curve it should be easier to do SSRS reports. – Ben Robinson Dec 10 '12 at 15:36
  • @BenRobinson, your comment, esp. "Creating an SSRS report to do what you need would take an hours or 2 at most, writing code to do the same thing in iTextSharp is a load of work" is probably what I was looking for when I seeked out what would be better - use reports of write out the code. can you please post it as an answer so that I can accept it? It does look like even for a simple invoice using reports would probably be the best choice - just because it includes least amount of work. Thanks – LocustHorde Dec 11 '12 at 10:08
  • @BenRobinson, can you please put your comment as answer? My accept score is 98% because I didn't accept an answer to this question and I did take your suggestion and used reporting services for solving it so I'd like to make your comment as an answer. – LocustHorde Jan 16 '13 at 13:18
  • I have added it as requested. – Ben Robinson Jan 16 '13 at 16:44

3 Answers3

2

There is a css property which should tell a browser to break a page: page-break-before.

But if you have a a wide list of browsers to support, it would be better to get some HTML to PDF conversion library or really use iTextSharp (as far as I know there is even a module/class which allows to conver HTML to PDF with iTextSharp) as printing web pages has many issues.

Viktor S.
  • 12,736
  • 1
  • 27
  • 52
1

In the past, when I wanted to create a reusable document, I used Word or Excel XML formats.

See: http://en.wikipedia.org/wiki/Microsoft_Office_XML_formats

They are easy to create and tweak, then all you have to do is recreate the dynamic parts in your code. All you have to do is save the document in Office XML format, then open it up in word pad to see where to make your changes.

Kaizen Programmer
  • 3,798
  • 1
  • 14
  • 30
  • Hi, this looked interesting.. until I tried it out.. I had to write thousands of lines just to get a table structure and data filled in! I ended up creating a template, loading it from disk, creating dynamic parts just like you suggested but I think it is a lot of hassle to do what I want, sorry! +1 because I didn't know about xml formats, that is pretty cool, may be I'll use it some day! – LocustHorde Dec 11 '12 at 10:07
0

SSRS has a drag and drop interface for designing reports and has a PDF output option. If the data is in a SQL server database then even with the learning curve it should be easier to do SSRS reports.

Ben Robinson
  • 21,601
  • 5
  • 62
  • 79