[futurebasic] Re: [FB] Printer Information

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : February 2007 : Group Archive : Group : All Groups

From: Bernie <fb.mailing.list@...>
Date: Mon, 12 Feb 2007 23:57:16 +0100
Peter,

I've never dabbled with the print manager but I think I've spotted a  
couple potential problems in your code:

(1)
	listformat = fn CreateFormatList(gFBPrintSession,fn  
CurrentPrinterMakeAndModel$( gFBPrintSession ))// {2/12/07}
is sending a pascal string as the second parm where it should be a  
PMPrinter type

try replacing that line with these two lines:
	err = fn PMSessionGetCurrentPrinter( gFBPrintSession, @printer )
	listformat = fn CreateFormatList( gFBPrintSession, printer )

(2)
The page format list is a list of PMPageFormat types, not  
CFStringRefs and can't be converted to pascal strings so I'd remove  
this line:
	print k+1, fn PascalFromCFString$(name)// {2/12/07}

(3)
In the two lines:
	err = fn PMGetUnadjustedPaperRect(pageFormat,@pageRect)
	err = fn PMGetUnadjustedPageRect(pageFormat,@pageRect)

shouldn't "pageFormat" be "name"?


Can't guarantee that these suggestions are correct.

Bernie




On 12 Feb 2007, at 22:27, Peter wrote:

> Hi Gang
> Thanks for the info about PageFormat it was enlightening.
> I'm trying to get the available sheet sizes for a specific printer,  
> so I thought I would try to adapt RP's code that is on the CD, but  
> there is some thing I don't understand, well there is lots I don't  
> understand, but specifically the PageFormatList does not seem to be  
> in the same format as the PrinterList. ie not CFArrayRef.
> here is the code I've got upto now, I've dated my changes
> < code snip >