Page 1 of 1

Command To Specify An Existing Printer

Posted: Tue Nov 08, 2016 12:09 am
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?

Re: Command To Specify An Existing Printer

Posted: Tue Nov 08, 2016 1:42 am
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

Re: Command To Specify An Existing Printer

Posted: Tue Nov 08, 2016 2:50 am
by d2848s29
I am developing on Mac OS. No Printer Lib for Mac OS besides PB one?

Re: Command To Specify An Existing Printer

Posted: Tue Nov 08, 2016 5:04 am
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.

Re: Command To Specify An Existing Printer

Posted: Tue Nov 08, 2016 2:07 pm
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.

Re: Command To Specify An Existing Printer

Posted: Tue Nov 08, 2016 6:08 pm
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.

Re: Command To Specify An Existing Printer

Posted: Tue Nov 08, 2016 6:08 pm
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!

Re: Command To Specify An Existing Printer

Posted: Tue Nov 08, 2016 11:47 pm
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.

Re: Command To Specify An Existing Printer

Posted: Wed Nov 09, 2016 2:57 am
by d2848s29
I wanted to use P.B. to write a label printing app with predefined label types to print to dedicated label printer.

Re: Command To Specify An Existing Printer

Posted: Wed Nov 09, 2016 3:20 am
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.

Re: Command To Specify An Existing Printer

Posted: Wed Nov 09, 2016 4:07 am
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.

Re: Command To Specify An Existing Printer

Posted: Wed Nov 09, 2016 7:24 am
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