Click here to Skip to main content
15,883,975 members
Everything / General Programming / Printing

Printing

printing

Great Reads

by Vahid_N
PdfReport is a code-first reporting engine which is built on top of the iTextSharp and EPPlus libraries.
by OriginalGriff
How to print labels in Word
by EFEaglehouse
Windows CE/Mobile printing client for LPR, LPRng, and Socket API.
by OriginalGriff
OK, OK. I had to set it up - Herself insisted - and I had to actually print to be sure. So I knocked up a quick box to print (just to show I could).

Latest Articles

by OriginalGriff
How to print labels in Word
by OriginalGriff
I'm getting a 3D printer for Christmas! So - I need to learn to use it. That means ... a CAD package. Gulp.
by OriginalGriff
So ... you want to put that LCD display in there, huh? Pity it's not a rectangular frame, isn't it? How are you going to fit a neat frame round that, huh? It's complicated, but ... not that complicated when you get used to it.
by OriginalGriff
OK, OK. I had to set it up - Herself insisted - and I had to actually print to be sure. So I knocked up a quick box to print (just to show I could).

All Articles

Sort by Score

Printing 

14 Feb 2013 by Vahid_N
PdfReport is a code-first reporting engine which is built on top of the iTextSharp and EPPlus libraries.
15 Dec 2022 by OriginalGriff
How to print labels in Word
26 Mar 2010 by Nicholas Butler
I think the point you're missing is that PrintPage is raised once for each page. If you set e.HasMorePages = true; when you finish and exit the handler, then it will be called again to print the next page. This will continue until you set e.HasMorePages = false; which indicates that you have...
15 Dec 2010 by EFEaglehouse
Windows CE/Mobile printing client for LPR, LPRng, and Socket API.
9 Mar 2013 by Michael Haephrati
It is not clear what you are developing. If you are developing a piece of software for someone else, you should create your own Print routine which will call printDocument 4 times, each time with the appropriate text. There is no way around that. Print drivers can usually allow you to define odd...
17 Sep 2019 by OriginalGriff
OK, OK. I had to set it up - Herself insisted - and I had to actually print to be sure. So I knocked up a quick box to print (just to show I could).
18 Nov 2010 by strogg
Dont know any app that does it, but here's some info.The shd file should contain just the print job settings, so you may ignore it.The spl file contains your print data. It can be recorded in RAW (printer format) or EMF format, dont know what you have.If its RAW:It may be in PS or PCL or...
17 Mar 2011 by fjdiewornncalwe
If you have command code documentation and a printer model, then the first place to look would be for an SDK or API specification from the manufacturer.
17 Mar 2011 by Albin Abel
Similar discussion here. May help you to get some idea.Print and send commands to receipt printer[^]
17 Mar 2011 by Espen Harlinn
You may find the following useful:http://www.microsoft.com/dynamics/rms/using/oposcontrols.htm[^]That one, and a bunch of others, can easily be found by leveraging your Google-Fu skills[^]RegardsEspen Harlinn
27 Jul 2012 by nagen bihari
Dear allFinally, I have solved the problem.Made a .dll filr from the link http://stackoverflow.com/questions/3507187/how-to-print-a-pcl-file-in-c.Added the dll to the GAC.Call it in my code.....and voila.......It prints my text file.Note that I am using a HP Laserjet P2015...
4 Nov 2012 by Akinmade Bond
Print, Cancel, Apply? I don't even have that on my PrintDialog.But maybe this articlel on hacking FontDialog can get you started. But I strongly suggest you create your own PrintDialog[^]
20 Sep 2013 by CHill60
I'm not convinced that you can do it without at least mentioning the printer name but you can temporarily change the default printer ...I found a solution here[^] that seems to work and by all accounts so does this one...
28 Aug 2016 by George Sefcik
This article will show an easy way to add the ability to print, or save as an image, each screen (Window) or FrameworkElement (UserControl) in your application.
6 Jun 2017 by juliashs
The following code works fine: DOCINFO Dinfo ; ... Dinfo.lpszOutput = (LPCSTR)"D:\\Test1.pdf";
8 Jun 2010 by CPallini
CWinApp::Updat...
21 Nov 2010 by strogg
This is a little different from normal printing routines.Open the printer using OpenPrinter() - make sure you send the data to the same printer.Call StartDocPrinter()Note: You must pass a DOC_INFO_1 structure with pDatatype(a member of it) set to "RAW" (upper case). This is not well...
22 May 2011 by Dalek Dave
This link[^] may help.Gives the method of orientating the print.
24 Jun 2011 by ankitjoshi24
HiI am not sure how you can negate the scroll but if you want to print the form then you can try: -PrintDialog printDlg = new System.Windows.Controls.PrintDialog();if (printDlg.ShowDialog() == true){ printDlg.PrintVisual(this, "First WPF Print");}The above code will...
10 Aug 2012 by Kenneth Haugland
The main problem with your question is I dont think we can answer it. Printers have some default settings that can be set via the .NET assembelies:http://msdn.microsoft.com/en-us/library/5ekk3hse[^]Your printer my store additional properties not required by the default printer class, and...
1 Jan 2013 by Sergey Alexandrovich Kryukov
You can use the WebBrowser control and print from it; it could be System.Windows.Forms.WebBrowser or System.Windows.Controls.WebBrowser. You know that.But there is one very different and interesting opportunity: the control from this CodeProject article: A Professional HTML Renderer You Will...
11 Sep 2013 by Member 10331745
Hello Everyone,I have been assigned a task to generate reports regarding printer. I want to know from some IP how many print outs has been taken from all connected printer in network. I want to check this through my web application.Tried every possible solution but could not find any...
16 Sep 2013 by Member 10331745
Hello Everyone,I have been assigned the task to monitor the jobs and generate the report related to Printer Activity in any way (online or stand alone system in c#).Like how many pages has been printed?, how many jobs printed?, how many double sided pages printed? From particular...
8 Oct 2014 by Sergey Alexandrovich Kryukov
It's almost always bad to start a separate process; it's much better to do your own print. You can use the class System.Drawing.Printing.PrintDocument:http://msdn.microsoft.com/en-us/library/system.drawing.printing.printdocument%28v=vs.110%29.aspx[^].As to the TIFF, you can create a...
24 Apr 2015 by Sergey Alexandrovich Kryukov
What you do could not work in principle — please see my comments to the question and the link. Instead of doing this very questionable stuff, you can use Microsoft.PointOfService.PosPrinter class which supports...
28 Sep 2015 by BillWoodruff
a quick sketch for one possible strategy: (not tested/working code !)public void ProcessCheckedRows(DataGridView dgv1){ // code by OP var allCheckedRows = dgv1.Rows .Cast() .Where(row => (bool?)row.Cells[0].Value == true) .ToList(); ...
2 Oct 2015 by Matt T Heffron
A variation on BillWoodruff's solution that allows generalization to an arbitrary number of "rows" per "Document" and works with the lazy behavior of IEnumerable:public void ProcessCheckedRows(DataGridView dgv1){ // code by OP var allCheckedRows = dgv1.Rows ...
12 Nov 2015 by claudetom01
Good evening,For that there are already many solutions in .NET, you go through the assembly. Drawing.Printing. See the examples that you can find everywhere even here;)PrintDocument ClassorBasic Text and Image PrintingorHow to print more pages in C#orPrinting in C#In your...
25 Jul 2016 by F-ES Sitecore
This is a frequently asked question, please do basic research such as a google search before you ask a question.The answer is that you can't. If the client wants to print something then they will. Would you want websites forcing things to your printer without your intervention?
29 Apr 2018 by Dave Kreskowiak
The problem is you're dealing with the Windows Print Spooler. The drawing stuff you do gets queued up, not directly printed. The printer driver has to convert your drawing commands into the language the printer understands to describe the page image, then that data has to be sent to the printer....
1 Jun 2018 by OriginalGriff
You create a print document: PrintDocument pd = new PrintDocument(); pd.PrintPage += new PrintPageEventHandler(printDocument1_PrintPage); Then you set the margins for a totally different one: Margins margins = new Margins(1, 1, 1, 1); printDocument1.DefaultPageSettings.Margins = margins;
29 Jul 2019 by Dave Kreskowiak
Your question makes no sense. Web App? Console App? Windows Service app? You didn't do a very good job of explaining what app is running where and how these apps relate to each other. What are these apps doing? How does this "Print button" work? What is the code behind it? "Default Printer" is...
12 Nov 2015 by Sergey Alexandrovich Kryukov
It all depends on the UI framework/library you are using. For System.Windows.Forms, you should better use PrintDocument (See Solution 1). For WPF… see, for example, http://www.c-sharpcorner.com/uploadfile/mahesh/printing-in-wpf[^].—SA
17 Feb 2024 by Jo_vb.net
I think this article could be a good starting point for you: Monitoring a Printer Queue from VB.NET[^]
8 Feb 2010 by Grunge Boy
I'm trying to create automatically PDF documents from WORD documents, using a PDF creator as a default printer. However, I don't want to use the PrintDialog everytime, I need to make it automatic by the source code ( I have thousands of WORD documents). The problem is that it seems I cannot...
2 Jun 2010 by preet88
Hi friends I want to print file contents using C++ program. Please tell me how I can do this. I don't know anything about printer programming. Please help me to sort out this problem. I want it to perform on C++. If you can provide me code to implement it, then it will be more helpful to me.
13 Jun 2010 by Richard MacCutchan
I found this link[^] which suggests that there was a method in the days of Win-95/NT, but I cannot be sure that it still works now; perhaps still worth investigating.
2 Aug 2010 by E.F. Nijboer
There are some options you could try. Since you only need to print the documents you only need a kind of viewer. There is an example here on codeproject for this:PDF Viewer Control Without Acrobat Reader Installed[^]Good luck!
7 Aug 2010 by Jörgen Sigvardsson
It will not load, because it is not signed. You will have to make Vista/Windows 7 boot up in so called 'test mode'. Google on it, and you will find plenty of articles showing you how to do this.
10 Aug 2010 by Shining Legend
I am using the below code for printing documents in ASP.NET. But the concern here is it is printing on the server not on client side. I want to print the documents on client machine.void PrintFiles() { ProcessStartInfo startInfo = new ProcessStartInfo(); ...
20 Sep 2010 by thatraja
Try this post Crystal Report Direct Print[^] It will help you.
2 Nov 2010 by Nish Nishant
See http://msdn.microsoft.com/en-us/library/aa287563(VS.71).aspx[^]It was part of VS 2003 documentation, but the concepts remain the same. You will see separate articles there showing how to print a text file, a data grid, a form, and one for print preview.
2 Nov 2010 by Arindam Tewary
Hi,I dont think while developing the application you have any control where user(accessing from client machine) would print it. You at most can "fire" the "print" command but rest all is taken care by client's system confiuration.Therefore, you can set aside the idea of instructing your...
24 Nov 2010 by #realJSOP
Wow. Color me surprised when I found out that searching google for "vb.net printing" resulted in over 900 THOUSAND hits. Imean - really - WOW!
5 Dec 2010 by puzzletrain
I have used this utility before look at http://www.dos2usb.com/index.htmI have had mixed results - i.e works most of the time in XP - not tried this on Vista or 7Net Use LPT1 \\ComputerName\Printer_Name /Persistent:YesI believe the printer has to be sharedor something I have not...
15 Dec 2010 by Henry Minute
You are more likely to get a valid answer by asking your question Ricoh Support Europe[^].
24 Dec 2010 by thatraja
venlancer wrote:tried using Printer setup but nothing worked for me. what do you mean? It's printing in other paper size? which one?I hope this option will kick this issue for you.Select the "No Printer" Option Under Print Setup[^]Have a great time, Merry Christmas :-O
31 Jan 2011 by Igor Kushnarev
Use Jasper Reports: http://jasperforge.org/projects/jasperreports[^]There is a good...
18 Mar 2011 by OriginalGriff
Your best bet is to talk to the manufacturers: they must be used to this question, and probably have a stock reply.The chances are that it varies from manufacturer to manufacturer.
13 Apr 2011 by musefan
So you are basically printing a screen shot? not good.You should be creating a print document based on the data.so you go through each data field and draw that on the print document where you want it. This is not so simple as you will need to calculate positioning and also take page...
14 Sep 2011 by OriginalGriff
Don't use the VB power packs for printing - use the PrintDocument [^]instead. That way, the printed result does not need to contain any UI components, it can just be the information you need to print, and you can fit it to the page any way you want. It will also look better, because the output...
16 Sep 2011 by Mehdi Gholam
See the answers to this earlier question C# Print long height form with printform component
4 Nov 2011 by cardano7
I finally found the way but I dont know how to add the port?rundll32 printui.dll,PrintUIEntry /if /b "Test Printer" /f "K:\Drivers\HP Color LaserJet CP1515\hppcp609.inf" /r "IP_10.48.1.42" /m "HP Color LaserJet CP1510 Series PCL 6"
8 Mar 2012 by R. Giskard Reventlov
This[^] might help: in VB but you can translate.
1 Apr 2012 by Abhinav S
Maybe you are referring to some article you read on the internet.In this case, please provide a reference to the article so that someone can help you.There are a couple of articles on printing a grid view that could be of some assistance in helping you solve this problem.Printing a...
4 May 2012 by OriginalGriff
Without having your specific printer to hand, it isn't easy - it will either be available via a menu on the printer itself, or locatable once you have installed the driver software.However, there may be another way. If you connect your browser to your router then you may be able to find out...
13 Jun 2012 by Abhinav S
Someone of the solutions described here[^] might help you out. Note that these are all workarounds to the original problem.
25 Jun 2012 by Tim Corey
Since you did not specify a specific thermal printer, I'll have to speak generally. In general, thermal printers use beeps as error codes. Therefore, they do not provide a way for the drivers to make them beep for other reasons. Further, it seems like a poor requirement, since it will be...
11 Jul 2012 by Richard MacCutchan
The driver will have exclusive rights to that serial port in order to drive the printer, and so protect itself from malicious code. Why not just use normal print processing via the standard printing utilities and classes?
25 Jul 2012 by Christian Graus
You can't change how the browser works. However, you should know that the code that you've copied, will not work all, and if you change the folder it stores the txt file in, in order that your web site would have access to it, it will print your document using whatever printer is attached to...
27 Jul 2012 by OriginalGriff
You should talk to the people who created it - they should provide technical support and will know more about their product than we will. If they don't, then find another supplier and demand your money back!
31 Jul 2012 by Christian Graus
The only real way to improve print quality is to create a larger bitmap that is finer quality. GIGO.graphics.FromImage(bitmap) creates an exact copy, though, you should not lose quality doing that.
15 Aug 2012 by M.H. Shojaei
There are some rows in my dataGrid, when i select one of them and print it's data, only first image of database will print while i only need to print selected row image.
19 Aug 2012 by M.H. Shojaei
I solved it.private void Print_Click(object sender, RoutedEventArgs e){ System.Windows.Controls.PrintDialog printDialog = new System.Windows.Controls.PrintDialog(); if (printDialog.ShowDialog() == true) { DrawingVisual dv = new DrawingVisual(); ...
24 Aug 2012 by Richard MacCutchan
Please do not post the same question in multiple forums. You have already posted this here[^].
2 Sep 2012 by Firdaus Shaikh
Hello Everyone, I have created a new form (custom PaperSize) for printer of certain width and height,Now I want to change it's height but through code?Is there any way to this, so that page size for that custom paper will change in the printer settings? Firdaus Shaikh
8 Oct 2012 by mst2
Hi,in the new layout i can't find the button for a printable version of an article. Where is it?thanks in advanceMathias
3 Nov 2012 by OriginalGriff
That's not going to be easy, and it may be a very, very silly idea.Certainly, on my system (vanilla Win7) the dialog that results from PrintDialog.ShowDialog contains no "Apply" button - just "OK" and "Cancel" so disabling or hiding the "Print" button won't work.If you need a dialog that...
12 Nov 2012 by OriginalGriff
Then you need to expand the PrintImage method to include something along the line of:this.DrawToBitmap(img, bounds);Point p = new Point(100, 100);e.Graphics.DrawImage(img, p);// Now add a string...e.Graphics.DrawString("Hello World!", new Font("Arial", 16), Brushes.Black, new...
1 Jan 2013 by prashant patil 4987
try this.You can use the WebBrowser control to do so. It will allow you to show HTML inside your WinForms.The DocumentText proprety will allow you to set a String that represent the HTML you want to show.For example:webBrowser.DocumentText = "I like...
3 Jan 2013 by Sergey Alexandrovich Kryukov
Please see my comment to the question.I really think you have more serious problems. Calling ToString on the object which is already a string. Repeating totally identical code with almost identical data 5 times. (Never heard of abstractions? Method? Method parameters? Don't Repeat Yourself...
13 Jan 2013 by markovl
Hey, you could set display:table-header-group; for your headers in a @media print rule, as shown here[^].I did a quick printing test in Firefox and IE9 and seems to do the job. Chrome for some reason doesn't honor it though.New content added after OPs comments in Solution 2:That's the...
9 Apr 2013 by Rai Pawan
You will need to have a domain account under which the windows service runs in order to access the printer that is available on network.Check this link http://stackoverflow.com/questions/8009558/printing-in-windows-service-using-background-worker[^]
10 Apr 2013 by ZurdoDev
Isn't it just a property? Something like printDocument1.DefaultPageSettings.Landscape?
16 Apr 2013 by SoMad
Turn the printer On. :) Just kidding, I am sure you already made sure it is connected and turned on.I found the link below, which has information about turning debugging logging on and in the last post, they say they fixed it by installing the driver with Administrative rights so it can...
27 May 2013 by Liju Sankar
Thank you very much for your suggestions and guidance.I found a couple of way to handle the situation a. Microsoft Print Preview controls b. Third party controls providers like Infragistics and Developer Express have there own extensions of this microsoft print preview controlBut...
28 May 2013 by Firdaus Shaikh
Hello Arun,Thanks for your reply I will try this and secondly,I have found a work around and below is the code,main code taken from somewhere I don't remember while finding every bit of code...this code is taken from Internet class named CustomPrintForm.cs1) Add below class in your...
4 Jun 2013 by Christian Graus
You can't. The only way to stop other programs from printing too much, is to have your own printer driver that won't accept more than XXX pages at a time. There may be a hook that allows you to write a layer between the OS and all printer drivers, but I'd be surprised, I'd imagine the best you...
22 Jul 2013 by Ron Beyer
Depends, what is your network architecture? Everything on a domain and part of Active Directory? If yes then its relatively easy to query AD objects. If you are just talking about a home network or workgroup network, then this is much more difficult as it involves network discovery.Please...
15 Oct 2013 by Sergey Alexandrovich Kryukov
How can you hope to get something good from this stone-age lame? No wonder Unicode support it a complete mess you would not like to deal with. Please see:http://www.west-wind.com/presentations/foxunicode/foxunicode.asp[^].—SA
19 Oct 2013 by thatraja
Here solved threadhttp://scn.sap.com/thread/3299135[^]
24 Oct 2013 by Marc Gabrie
1) ZPL & EPL are common Zebra printer command languages and can be used with any Zebra printer supporting them as well as with other brands that usually ship ZPL or EPL emulation like Datamax, Intermec, etc. If you want to support a broader range of printers, then ZPL & EPL is not the way to go....
26 Oct 2013 by Marc Gabrie
You wrote..."we have around 200 label printers(configured for static ip machines) and those has to print around 100k labels every day"How is the printing performance with such a high printing volume and based on the fact that you are using Windows graphic printing API (approach-I i.e....
7 Nov 2013 by Marc Gabrie
#1 AFAIK, there's any Zebra printer which model is GC420GT! It's important to know the correct model of your Zebra (read on)#2 In ZPL, the ^MMC,Y command should be sufficient and placed at the beginning of your label format. I see you also have specified ^CN but from ZPL ref this commands...
14 Nov 2013 by Roja23
http://files.support.epson.com/htmldocs/pho22_/pho22_rf/speed_1.htm[^]
28 Jan 2014 by Jochen Arndt
There is an old KB article HOWTO: Send Raw Data to a Printer by Using the Win32 API[^] referring to Windows 9x and NT. So I don't know if it is also working with newer Windows versions. All you need to know is the name of the printer. Then read the data from the PCL file and write it to the printer.
24 Feb 2014 by Dave Kreskowiak
Well, you HAVE to run the Office applications to print the documents. What else are you going to use to open the documents, parse them to render the page and printer them?? Without Office, you have no code that knows how to interpret and render the documents!You don't neccessarily need...
24 Mar 2014 by Marc Gabrie
I'd not use Crystal Reports or any other reporting tool for printing bills IF you are targeting special printers like thermals or dot matrix/impact ones. Instead, I'd try to learn the printer target language commands (ESC/POS in your case which is not hard to learn at all) and would send the raw...
31 Mar 2014 by Marc Gabrie
If you already know about ZPL commands then just create/design your labels using it and then send those commands to the printer by using this code http://support.microsoft.com/kb/322091If you do not know anything on Zebra printer languages then try this open source project...
10 Jun 2014 by AlwaysLearningNewStuff
INTRODUCTION AND RELEVANT INFORMATION:I am trying to bypass another problem in my application by trying to do printing/print preview on my own.I am trying to create a table that would look like in this picture[^].I am using C++ and WinAPI, on WindowsXP SP3. I work in MS Visual Studio...
17 Jun 2014 by Kschuler
I think you'd be better off using My.Settings[^] than using text files to store this information.Right Click on your Project in the Solution Explorer. Select Properties. This opens your project's property pages.Select the Settings Tab. This area lets you setup various settings that...
15 Aug 2014 by OriginalGriff
The problem is that you are just drawing the panel into a bitmap - so you will get exactly teh same thing as if you had drawn it onto the screen - the panel doesn't "know" where it is drawing to (and rightly, it shouldn't need to know).If you want to lose the background, you will have to...
7 Sep 2014 by Marc Gabrie
Instead of using Crystal Reports or any other reporting tool, I'd suggest you to use System.Drawing.Printing.PrintDocument[^] which is simple enough to reproduce POS outputs on common printers. A receipt usually contains plain text + some logo image which can be easily reproduced by using...
13 Sep 2014 by Nelek
Have a look:http://social.msdn.microsoft.com/Forums/vstudio/en-US/3a7d5f8b-b2d3-45dd-b2e7-959c3d55445c/barcode-generation-and-printing[^]it might help, or point you some directions out
14 Sep 2014 by Marc Gabrie
ZPL is very straightforward and simple to create as it's a plain text printer command language. You can send those commands to the printer by using this code http://support.microsoft.com/kb/322090If you do not want to learn ZPL or do not have time to spent on it, then try this open source...
16 Sep 2014 by Aitizaz Khan
Hi,I just want to know how can i decode the windows spooler .spl file to get the text i just printed.I know i have to do some kind of decoding but i need a little help from where to start. I am using USB POS Receipt printersThanks
4 Nov 2014 by Liju Sankar
Please take a look at the these linksHow to Silently Print PDFs using Adobe Reader and C#Print existing PDF in C#
27 Dec 2014 by OriginalGriff
Look at the PrintDocument class[^] - it allows you to specify exactly what is printed, where, and what size. You shouldn't use PrintForm - it's a poor solution that doesn;t generally give good results. It's only real use is for debugging when you need an image of the whole screen to show an...
15 Jan 2015 by Stan Huang
There may be lots of causes for such bug. In my case, it happened several times and I worked out it by re-building the driver in the development environment where the underlying image was built. That is, the drivers must be built at the same development environment as the kernel image. A little...
29 Jun 2015 by OriginalGriff
That code is for sending raw printer data to a printer, effectively bypassing the printer driver which normally translates it into something the printer hardware can understand. It expects that the data it reads from a file is already compatible with the exact make and model of printer you are...