macOS/iOS API解説

iOS , Mac アプリケーション開発のために使われる主要フレームワークの日本語情報です。2010年代に書かれた内容です。今後更新はありません。

目次

pageSizeForPaper:

指定した用紙のサイズをポイントで返します
-(NSSize)pageSizeForPaper:(NSString *)paperName:

解説

指定した用紙のサイズをポイントで返します。
PPDで設定されたサイズです。

返り値

( NSSize )

サイズ

引数

( NSString * )paperName

用紙名

フレームワーク

ApplicationKit

クラス

NSPrinter

Instance Methods

使用可能

10.0

参照

- imageRectForPaper:

例文

#import "Controller.h"

@implementation Controller

- (IBAction)pushButton:(id)sender
{
NSSize size =[[NSPrintInfo defaultPrinter] pageSizeForPaper:@"A4"];
NSLog([NSString stringWithFormat:@"w=%.1f,h=%.1f",size.width,size.height]);

}

@end