Printer settings through Carbon API

Mac OSX specific forum
coder14
Enthusiast
Enthusiast
Posts: 327
Joined: Tue Jun 21, 2011 10:39 am

Printer settings through Carbon API

Post by coder14 »

PureBasic has some great printer functions, but unfortunately some of the basic ones are missing. Is there any way I can use API calls to programatically get/set resolution, paper size, orientation and also the number of copies to print?

Is there anything similar to the WinAPI EnumDisplaySettings/ChangeDisplaySettings, where we can use the DEVMODE structure to initialize the settings?
jesperbrannmark
Enthusiast
Enthusiast
Posts: 536
Joined: Mon Feb 16, 2009 10:42 am
Location: sweden
Contact:

Re: Printer settings through Carbon API

Post by jesperbrannmark »

I think the only safe way to do a print is to generate a HTML or PDF file and then open that on screen and let the user print.
Both can be done with the excellent Applescript wrapper!
coder14
Enthusiast
Enthusiast
Posts: 327
Joined: Tue Jun 21, 2011 10:39 am

Re: Printer settings through Carbon API

Post by coder14 »

jesperbrannmark wrote:I think the only safe way to do a print is to generate a HTML or PDF file and then open that on screen and let the user print.
Both can be done with the excellent Applescript wrapper!
You don't really need to do that - PB already has a set of good built-in functions to do WYSIWYG printing. But how can I control settings like orientation and number of copies, to print directly to the default printer without the PrintRequester?
WilliamL
Addict
Addict
Posts: 1259
Joined: Mon Aug 04, 2008 10:56 pm
Location: Seattle, USA

Re: Printer settings through Carbon API

Post by WilliamL »

PB already has a set of good built-in functions...
Not for the Mac. All printing is done from an image as I pointed out in my 'Programming on the Mac platform' thread. http://www.purebasic.fr/english/viewtop ... 19&t=45613
MacBook Pro-M1 (2021), Tahoe 26.2, PB 6.30b6
coder14
Enthusiast
Enthusiast
Posts: 327
Joined: Tue Jun 21, 2011 10:39 am

Re: Printer settings through Carbon API

Post by coder14 »

WilliamL wrote:
PB already has a set of good built-in functions...
Not for the Mac. All printing is done from an image as I pointed out in my 'Programming on the Mac platform' thread. http://www.purebasic.fr/english/viewtop ... 19&t=45613
Whoa! You're right - the rendering for both text and graphics is really blurry and pixelated. I can't seem to find any way around this. Does anyone have any idea how to call the Carbon functions (PMCreateSession, PMBeginDocument, etc) from within PB? It seems complicated - is it even possible?
Post Reply