Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / Mac Programming / December 2006



Tip: Looking for answers? Try searching our database.

Printing to two printers

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Paul - 21 Dec 2006 23:11 GMT
Hi,

I wrote a simple label programme for my own use. It prints a carton list
to a Xerox laser printer (network) on A4 paper and small sticky labels
from a Dymo 400 printer (local USB).

The problem is that if I print the A4 list first the labels printed on
the Dymo are messed up - prints a label and then feeds 2 or 3 labels
before printing the next label. Also, if I print the labels then the
list the list prints on the wrong paper (US Letter) and wrong
orientation (landscape).

If I quit after printing either the labels or the list and launch the
app again and print the other it works fine.

I really don't want to select the printer each time so I've hard wired
both printers to two different "print" buttons.

Code follows for each button. Any help appreciated, thanks.

Regards,

Paul
-----------------------------
// Print labels (myView)

NSPrinter *printer;
printer = [NSPrinter printerWithName:@"LabelWriter 400 Turbo"];
       
NSPrintInfo *printInfo = [NSPrintInfo sharedPrintInfo];
[printInfo setPrinter:printer];
[printInfo setPaperName:@"30256 Shipping"];
[printInfo setOrientation:NSLandscapeOrientation];
       
NSSize sz;
sz.width = 288;
sz.height = 166;
       
[printInfo setPaperSize:sz];

NSPrintOperation *printOP;      
printOP = [NSPrintOperation printOperationWithView:myView

printInfo:printInfo];
[printOP setShowsPrintPanel:NO];
[printOP runOperation];

=========================================
// Print carton list (plView)

NSPrinter *printer;
printer = [NSPrinter printerWithName:@"Phaser 6200DP"];
       
NSPrintInfo *printInfo = [NSPrintInfo sharedPrintInfo];
[printInfo setPrinter:printer];
[printInfo setPaperName:@"A4"];
[printInfo setOrientation:NSPortraitOrientation];

NSPrintOperation *printOP;
printOP = [NSPrintOperation printOperationWithView:plView

printInfo:printInfo];
[printOP setShowsPrintPanel:NO];
[printOP runOperation];

----------
Patrick Machielse - 21 Dec 2006 23:45 GMT
> The problem is that if I print the A4 list first the labels printed on
> the Dymo are messed up - prints a label and then feeds 2 or 3 labels
> before printing the next label. Also, if I print the labels then the
> list the list prints on the wrong paper (US Letter) and wrong
> orientation (landscape).

[]

> -----------------------------
> // Print labels (myView)
[quoted text clipped - 12 lines]
>        
> [printInfo setPaperSize:sz];

[]

> =========================================
> // Print carton list (plView)
[quoted text clipped - 6 lines]
> [printInfo setPaperName:@"A4"];
> [printInfo setOrientation:NSPortraitOrientation];

I think the problem is a result of using +[NSPrintInfo sharedPrintInfo].
As the name implies, you are sharing this object between both printjobs.
Since you are printing to different printers, this is probably not what
you want... Instead, try setting up the info for each printer using
-[NSPrintInfo initWithDictionary].

patrick

patrick
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.