Command To Specify An Existing Printer

Just starting out? Need help? Post your questions and find answers here.
d2848s29
User
User
Posts: 18
Joined: Wed Oct 05, 2016 3:49 pm
Location: Wisconsin, USA

Command To Specify An Existing Printer

Post by d2848s29 »

What is the command to specify an existing os printer? All I see in the docs is DefaultPrinter() which returns the os's default printer. Is there also a command to list the existing printers?
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Command To Specify An Existing Printer

Post by IdeasVacuum »

You need to enumerate all of the existing printers (and present a list for the User to choose from). That currently requires API functions. If for Windows OS, try ABBKlaus's Printer Lib for PB:
http://www.purebasicpower.de
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
d2848s29
User
User
Posts: 18
Joined: Wed Oct 05, 2016 3:49 pm
Location: Wisconsin, USA

Re: Command To Specify An Existing Printer

Post by d2848s29 »

I am developing on Mac OS. No Printer Lib for Mac OS besides PB one?
User avatar
TI-994A
Addict
Addict
Posts: 2700
Joined: Sat Feb 19, 2011 3:47 am
Location: Singapore
Contact:

Re: Command To Specify An Existing Printer

Post by TI-994A »

d2848s29 wrote:What is the command to specify an existing os printer? All I see in the docs is DefaultPrinter() which returns the os's default printer. Is there also a command to list the existing printers?
Unless more settings are required, PureBasic's PrintRequester() should be quite sufficient.
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel :D
User avatar
Shardik
Addict
Addict
Posts: 2058
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: Command To Specify An Existing Printer

Post by Shardik »

d2848s29 wrote:Is there also a command to list the existing printers?
When looking for MacOS examples which require OS-specific API commands you should always take a look into wilbert's thread [PB Cocoa] Methods, Tips & Tricks which contains a list of links to code examples of many different topics. It also contains a link to this code example which lists all available printers.
d2848s29
User
User
Posts: 18
Joined: Wed Oct 05, 2016 3:49 pm
Location: Wisconsin, USA

Re: Command To Specify An Existing Printer

Post by d2848s29 »

TI-994A wrote:
d2848s29 wrote:What is the command to specify an existing os printer? All I see in the docs is DefaultPrinter() which returns the os's default printer. Is there also a command to list the existing printers?
Unless more settings are required, PureBasic's PrintRequester() should be quite sufficient.
I would like the code to specify the printer with no dialog box.
d2848s29
User
User
Posts: 18
Joined: Wed Oct 05, 2016 3:49 pm
Location: Wisconsin, USA

Re: Command To Specify An Existing Printer

Post by d2848s29 »

Shardik wrote:
d2848s29 wrote:Is there also a command to list the existing printers?
When looking for MacOS examples which require OS-specific API commands you should always take a look into wilbert's thread [PB Cocoa] Methods, Tips & Tricks which contains a list of links to code examples of many different topics. It also contains a link to this code example which lists all available printers.
Thank you!
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Command To Specify An Existing Printer

Post by IdeasVacuum »

I would hope PrintRequester() is sufficient in most cases, but essentially it is out of the control of your app - you might need to know what the paper size/orientation is for example, to ensure a valid print file is sent.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
d2848s29
User
User
Posts: 18
Joined: Wed Oct 05, 2016 3:49 pm
Location: Wisconsin, USA

Re: Command To Specify An Existing Printer

Post by d2848s29 »

I wanted to use P.B. to write a label printing app with predefined label types to print to dedicated label printer.
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Command To Specify An Existing Printer

Post by IdeasVacuum »

I wanted to use P.B. to write a label printing app with predefined label types to print to dedicated label printer.
Using the code Shardik has linked to, you can get a list of all available printers and I imagine you already know which one in that list is the dedicated label printer, so you should be fine from there as Shardik's link also has available paper covered too.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
d2848s29
User
User
Posts: 18
Joined: Wed Oct 05, 2016 3:49 pm
Location: Wisconsin, USA

Re: Command To Specify An Existing Printer

Post by d2848s29 »

IdeasVacuum wrote:
I wanted to use P.B. to write a label printing app with predefined label types to print to dedicated label printer.
Using the code Shardik has linked to, you can get a list of all available printers and I imagine you already know which one in that list is the dedicated label printer, so you should be fine from there as Shardik's link also has available paper covered too.
That example does not show how to specify the active printer and set its page attributes. I will dig into Cocoa docs to see if that can be done from P.B. using the CocoaMessage function.
collectordave
Addict
Addict
Posts: 1310
Joined: Fri Aug 28, 2015 6:10 pm
Location: Portugal

Re: Command To Specify An Existing Printer

Post by collectordave »

Hi

You could take a look at this thread for windows and Mac.

http://www.purebasic.fr/english/viewtop ... +Module%3A

Regards

cd
Any intelligent fool can make things bigger and more complex. It takes a touch of genius — and a lot of courage to move in the opposite direction.
Post Reply