473,837 Members | 1,862 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

print "N-up?"

I am trying to print some 2x6 labels on a SATO CL408e thermal label printer. The 2x6 labels are arranged in "landscape" mode with 2 labels per "sheet." When I attempt to print "x" copies of a 1 page label document, I get "x" formfeeds and "x" wasted labels.

Is there any way to manipulate the .NET printing engine to do a over-under 2-up landscape printing? I'm thinking no, but maybe there's a way. The printer has the ability to sense the end of a label, but apparently it can't sense that there are 2 labels side-by-side on the feed.

I am thinking that the only solution is to treat the two labels as 1 4x6 landscape label and just always print an even number of labels.

I am including the code that I am using to generate and print the labels:
/// <summary>/// /// </summary>/// <param name="Quantity" ></param>public void PrintBoxLabel(s hort Quantity){ short labelQty = Quantity; printDoc = new PrintDocument() ; printDoc.PrintP age += new PrintPageEventH andler(this.pri ntDoc_PrintBoxL abel); printDoc.EndPri nt += new PrintEventHandl er(this.printDo c_EndBoxPrint); printDoc.Printe rSettings.Print erName = (string)App.Con fig["boxCartonPalle tPrinter"]; printDoc.Docume ntName = this.stockCode; printDoc.Printe rSettings.Copie s = labelQty; printDoc.Defaul tPageSettings.L andscape = true; foreach (PaperSize psz in printDoc.Printe rSettings.Paper Sizes) { if (psz.PaperName == (string)App.Con fig["boxCartonPalle tPaperSize"]) { printDoc.Defaul tPageSettings.P aperSize = psz; break; } } printDoc.Defaul tPageSettings.M argins.Left = 0; printDoc.Defaul tPageSettings.M argins.Right = 0; printDoc.Defaul tPageSettings.M argins.Top = 0; printDoc.Defaul tPageSettings.M argins.Bottom = 0; printDoc.Origin AtMargins = true; printDoc.Print( );}private void printDoc_PrintB oxLabel(object sender, PrintPageEventA rgs e){ Graphics grfx = e.Graphics; SizeF sizef; Font cooFont = new Font("Lucida Console", 10); Font uomFont = new Font("Lucida Console", 14); Font stkFont = new Font("Lucida Console", 16); string spanishText = ""; string frenchText = ""; string baseLabelText = (string)stk["CountryOfOrigi n"]; string boxCode = (string)stk["BoxLabelCo de"]; int unitOfMeasure = (int)stk["UnitOfMeas ure"]; float barWidth = (float)(26.7 * .00254); float barHeight = (float)1.5; float barRatio = (float)2.81; switch (baseLabelText) { case "Made in USA": spanishText = "Hecho en E.U.A."; frenchText = "Fabriqu\x0 0E9 en Etats Unis"; break; case "Made in Turkey": spanishText = "Hecho en Turqu\x00EDa"; frenchText = "Fabriqu\x0 0E9 en Turqie"; break; case "Made in India": spanishText = "Hecho en la India"; frenchText = "Fabriqu\x0 0E9 en Inde"; break; case "Made in Italy": spanishText = "Hecho en Italia"; frenchText = "Fabriqu\x0 0E9 en Italie"; break; case "Made in Mexico": spanishText = "Hecho en M\x00E9xico"; frenchText = "Fabriqu\x0 0E9 au Mexico"; break; case "Made in Philippines": spanishText = "Hecho en Filipinas"; frenchText = "Fabriqu\x0 0E9 en Philipines"; break; } // Draw the stock code in the upper left sizef = grfx.MeasureStr ing(this.stockC ode, stkFont); grfx.DrawString (this.stockCode , stkFont, Brushes.Black, (float)37.5, 25); // Draw the Unit of Measure in the upper right grfx.DrawString (unitOfMeasure. ToString(), uomFont, Brushes.Black, 415, 25); // Draw the "Each","Chaque" , "Cada Uno" in the upper right grfx.DrawString ("Each", cooFont, Brushes.Black, 470, (float)12.5); grfx.DrawString ("Chaque", cooFont, Brushes.Black, 470, 32); grfx.DrawString ("Cada Uno", cooFont, Brushes.Black, 470, 50); // Draw the horizontal line across the label grfx.DrawLine(n ew Pen(Brushes.Bla ck, 1), 0, (float)62.5, 600, (float)62.5); //Draw the barcode on the label RectangleF rect = Barcode.DrawInt erleved2Of5(box Code, "", true, BarcodeLabelAli gnment.BelowCen ter, barWidth, 0, barHeight, barRatio, (float).5, false, new RectangleF(25, 82, 350, 110), new Font("Lucida Console", 14), Color.Black, grfx); // Draw the country of origin strings on the right side of the label sizef = grfx.MeasureStr ing(baseLabelTe xt, cooFont); grfx.DrawString (baseLabelText, cooFont, Brushes.Black, 375 + ((225 - sizef.Width) / 2), (float)87.5); sizef = grfx.MeasureStr ing(spanishText , cooFont); grfx.DrawString (spanishText, cooFont, Brushes.Black, 375 + ((225 - sizef.Width) / 2), (float)120); sizef = grfx.MeasureStr ing(frenchText, cooFont); grfx.DrawString (frenchText, cooFont, Brushes.Black, 375 + ((225 - sizef.Width) / 2), (float)150); e.HasMorePages = false;}Thanks in advance,Matthew BelkBizSpeed Inc.
Nov 16 '05 #1
0 1830

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
2412
by: Michael Foord | last post by:
Here's a little oddity with 'print' being a reserved word... >>> class thing: pass >>> something = thing() >>> something.print = 3 SyntaxError: invalid syntax >>> print something.__dict__ {}
14
2922
by: Marcin Ciura | last post by:
Here is a pre-PEP about print that I wrote recently. Please let me know what is the community's opinion on it. Cheers, Marcin PEP: XXX Title: Print Without Intervening Space Version: $Revision: 0.0 $
0
1838
by: bearophileHUGS | last post by:
There is/was a long discussion about the replacement for print in Python 3.0 (I don't know if this discussion is finished): http://mail.python.org/pipermail/python-dev/2005-September/055968.html There is also a wiki page that collects the ideas: http://wiki.python.org/moin/PrintAsFunction There is the will to keep the printing operation very simple for the most common situation, but at the same time to make it flexible (optional no...
1
5725
by: hamil | last post by:
I am trying to print a graphic file (tif) and also use the PrintPreview control, the PageSetup control, and the Print dialog control. The code attached is a concatination of two examples taken out of a Microsoft book, "Visual Basic,Net Step by Step" in Chapter 18. All but the bottom two subroutines will open a text file, and then allow me to use the above controls, example 1. The bottom two subroutines will print a graphic file, example...
3
2115
by: James J. Besemer | last post by:
I would like to champion a proposed enhancement to Python. I describe the basic idea below, in order to gage community interest. Right now, it's only an idea, and I'm sure there's room for improvement. And of course it's possible there's some serious "gotcha" I've overlooked. Thus I welcome any and all comments. If there's some agreement that this proposal is worth further consideration then I'll re-submit a formal document in...
69
3234
by: Edward K Ream | last post by:
The pros and cons of making 'print' a function in Python 3.x are well discussed at: http://mail.python.org/pipermail/python-dev/2005-September/056154.html Alas, it appears that the effect of this pep would be to make it impossible to use the name 'print' in a backward compatible manner. Indeed, if a program is to compile in both Python 2.x and Python 3.x, the print function (or the print statement with parentheses) can not use the...
2
22134
by: Brad Pears | last post by:
I have some sample code that uses the print dialog, print preview and a print direct options. If I select print preview and then click the printer icon from that, the document prints. If I select the print directly option, it also prints right away to the defauilt printer. However, if I use the printer dialog control to print and I click 'OK' to actually print the document - nothing happens. The job does not even go into the print...
7
10765
by: samslists | last post by:
Am I the only one that thinks this would be useful? :) I'd really like to be able to use python 3.0's print statement in 2.x. Is this at least being considered as an option for 2.6? It seems like it would be helpful with transitioning.
2
3216
by: ravir81 | last post by:
Hi, I am working on excel reporting using Perl. I am facing problem with writing the header part only once for all the excels created using Perl. Here is the code : #!/usr/local/bin/perl use strict; use Spreadsheet::ParseExcel;
11
4234
by: JWest46088 | last post by:
I'm having difficulty trying to figure out how to print a text file from a hash table one line at a time. I have the text file read into the hash table and can print the text file all at once, but I can't seem to figure out how to do it one line at a time. Here is what I'm trying to do: I want the user to be able to print the text file one line at a time by clicking a button to see the next line. Example: If text_file1 first line is...
0
9843
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9682
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10875
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10566
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10272
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9401
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5669
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4474
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3124
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.