简体   繁体   English

如何在ASP.NET C#中创建多页发票?

[英]How to create a multiple page invoice in asp.net c#?

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. 现在,要生成实际的发票,我真的不想使用Telerik,SSRS等报告解决方案。因为我认为这些解决方案对我来说太过分了。 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. 我可以使用ITextSharp或其他方法来生成pdf。实际上,我认为如果无法仅输出到html页面并让打印机以某种方式识别分页符,我将继续进行。

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 谢谢

There is a css property which should tell a browser to break a page: page-break-before . 有一个CSS属性可以告诉浏览器分页: page-break-before

But if you have aa 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. 但是,如果您要支持的浏览器种类繁多,最好获得一些HTML到PDF的转换库或真正使用iTextSharp(据我所知,甚至有一个模块/类都可以使用iTextSharp将HTML转换为PDF ),因为打印网页有很多问题。

In the past, when I wanted to create a reusable document, I used Word or Excel XML formats. 过去,当我想创建可重用的文档时,我使用Word或Excel XML格式。

See: http://en.wikipedia.org/wiki/Microsoft_Office_XML_formats 请参阅: 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. 您所要做的就是将文档保存为Office XML格式,然后在写字板中打开以查看在何处进行更改。

SSRS has a drag and drop interface for designing reports and has a PDF output option. SSRS具有用于设计报告的拖放界面,并具有PDF输出选项。 If the data is in a SQL server database then even with the learning curve it should be easier to do SSRS reports. 如果数据在SQL Server数据库中,则即使具有学习曲线,也应该更容易进行SSRS报告。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM