• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: No-frills print to label printer help please (Rick Mann)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: No-frills print to label printer help please (Rick Mann)


  • Subject: Re: No-frills print to label printer help please (Rick Mann)
  • From: David Phillip Oster <email@hidden>
  • Date: Sun, 25 May 2008 13:40:10 -0700

At Sun, 25 May 2008 10:42:26 -0700, No-frills print to label printer help please (Rick Mann):

I'm writing a small app to print labels. Currently I'm targeting a Dymo LabelWriter 400 Turbo (a little USB printer) using a small 2.3" X 4" label. I created a view in my app that uses that aspect ratio (I have yet to find out the printer's actual resolution) at about 315 X 182. I draw a number of NSStrings in the view at different sizes and fonts.


My first pass at a print routing just calls

	[[NSPrintOperation printOperationWithView: mLabelView] runOperation];

and it prints, but presents the print dialog and shows a tiny version of my view in the center of the page with the wrong orientation (if I select "scale to fit paper size" in the Paper Handling section of the print dialog; if I don't select "Scale to fit paper size," it shoots out one blank label).

What I want is for my view to scale to fit the entire label, rotated to print wide, and i don't want the user to have to deal with the print dialog. There will be hundreds of individual labels being printed, but all in the same fashion. (There will be a pref for setting the printer/label size one time.)

I'm still reading through the printing docs, but maybe someone can point me to the specific things I need to look at to do this right? I'm sure there are many ways. For example, I could get the page size from the print info record, make the view that size, rotate my text and draw. But it seems like there should be an easier way to have my view rotated and scaled to fit the page (programmatically).

TIA,
--
Rick

See my posting on a similar topic, print resolution: http://groups.google.com/group/comp.sys.mac.programmer.help/msg/a6136ac7893b54f9

If you don't want a print dialog, call: [printOp setShowPanels:NO];

If you want to set the print information once: a NSPrintInfo obeys the NSCoding protocol, so you can saved it to a file using NSkeyedArchiver, and restore it with NSKeyedUnarchiver.

If the user didn't set the correct portrait versus landscape mode, you can set an NSAffineTransform at the beginning of your drawRect, and it will handle the rotation for you.

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Re: How to retrieve conversion factors from internet?
  • Next by Date: Re: Scope in an interface?
  • Previous by thread: re: How hard is it to learn Cocoa - Survey ?
  • Next by thread: ANN: MYNetwork library, including abstract TCP client/server and BLIP protocol
  • Index(es):
    • Date
    • Thread