I have a dot matrix printer and an already designed invoice.
How do I print the datagridview items in the specified section of the Invoice Template?
I searched alot for how to set boundaries in printdocument class for that purpose but I didn't found an answer. Please help...
My Application looks like this
The quickest way to generate a neatly formatted output is to use a reporting tool to layout your report and pass the data to it and let it worry about rendering to the printer.
There's Crystal Reports, Sql Server Reporting Services, ActiveReports.Net just to name a few.
I manage to do it by this method
Related
I have a .net application in c# where I'm trying to print using a pdf document on the left side and a text description on the right side. So far I've been successful in combining the 2 outputs into one pdf file, but am stumped on how to programmatically do it so that when I go to print, then in the Page Sizing & Handling section, select "Multiple" and set pages per sheet to 2.
My guess is it's a process print feature somewhere but can't seem to find any examples nor clear documentation to do so. Please advise, thanks.
if you want to set pages per sheet from the backend rather than print/ print dialog you have to use PrintTicket Class [System.Printing]. this classs have lots of property and events that can allow us to do lots of printing and printing job related stuff using c# code. there is also many classes related to printing in this name space[ may you know about the xps in windows when you going to print may you see option print to xps it is belongs to Print Schema class]
you can read more about it from https://msdn.microsoft.com/en-us/library/system.printing.printticket.aspx
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
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.
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.
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.
I've been programming an application that deals with a POS printer. The printer is BIXOLON branded, and I haven't found any SDKs for using this type of printers as well as no example on how to deal with it.
Since I'm new to this type of printer, I don't know how should I design my report as well as which report engine should I use.
Any advice will be helpful.
I have worked on POS printers before to issue receipts etc.
What I did is to read in a template from a rtf file, set some variables that is to be replaced.
For example for the receipt I want to have the name of the person, so in the rtf file template, I would put something like <NAME>. When I read in the content of the rtf file, i just do a string.replace to replace <NAME> with the actual text in my program. Once I have replaced all the variables, using the class found in this link.
http://msdn.microsoft.com/en-us/library/ms996492.aspx#wnf_richtextbox_topic06 , I have a well formatted rtf and ready to be printed.
Printing wise works just like other printer. This means that as long as your coding targeted the correct printer and using the correct setup, it should be printed correctly. The only difference is that printing on a office printer would give u a A4 size, whereas printing on a POS printer will give you the size allowed by the POS printer. Just remember to format your rtf well.
Most report engines (I'm thinking of Reporting Services in particular) won't need this level of programming to print reports. You will get that functionality out of the box as long as the printer drivers are installed on the machine you wish to print reports from.
It was so simple, I used crystal report to design my report and then easily show.
In my work we need to generate contract documents that dynamically extract information from the database to personalize client related information.
These documents not only have text, but also they need tables with dynamic rows (ie.: shows some products owned by the client). These tables can be placed in different parts of the document and they can be between paragraphs.
The important thing is that: the texts must be justified (a legal requeriment of my country)
We do these documents with Reporting Services and export them to PDF, but this tool doesn't provide justified text.
i did some googleing and found that there is no way to justify text in Reporting Services.
Is there another way to do this? if not, can you give me some alternative to solve this issue?
We work with ASP.NET in C#.
Thanks in advance
You might be able to export them to Word, where I believe you would have greater control over the justification, then convert the Word document to a PDF.
I've searched Stackoverflow and google and found many ways
how I can print stuff in C#.
The best way for me would be to populate blank white windows form
with some label, textbox and picturebox elements and print it as a windows form.
This way is very poor because it prints in 72 DPI, and is not flexible for multiple
pages print.
Next way that I found that would be good is using iTextSharp, but there is a problem
that iTextSharp only generates PDF-s, and you have to open it in PDF viewer and print
from there.
I love this way of thinking where I create a paragraph, and then fill it with text and graphic, so I found this thread
http://www.devarticles.com/c/a/C-Sharp/Printing-Using-C-sharp/
where it discusses how to create your own printing engine in C#, something like iTextSharp,
but very lightweight...
Now that I've said that, I want to know is there any ready to use printing engine that would be like iTextSharp, made for printing, not for PDF generation? What is the best way to print something, without using reporting services like CrystalReports.
I think Crystal Reports wouldn't work for my case cause I don't want to print generic reports, but some text and graphics that I need to dynamicaly generate every time I need to print.
I found that it was much easier to do printing using the printing stuff in WPF.
EDIT
XPS is the page description format that Microsoft included into .NET with .NET 3.0. It is nominally part of WPF, and is integrated with the WPF form layout model. But you can create XPS documents in memory and send them to printers, from any .NET app, including a WinForms App.
An example:
http://statestreetgang.net/post/2008/03/Creating-an-XPS-document-in-memory-via-the-DOM.aspx
It is approximately equivalent to the iTextSharp capability you explored, except:
you can do it all in memory if you like, no need to save to a filesystem file. Of course if you want to save to a filesystem file, you can do that too.
you don't need an external viewer in order to start the print.
If you are new in programming and you have some data like from Data Base, and you want to print it after retrieving it from Data Base. Then just follow this link it will guide you step by step.
Print Data in Dot Net (C#,Vb.net)