iosios7nsprintinfo

NSPrintInfo localizedPaperName, how to get paper name in ios?


On my mac I use NSPrintInfo and [NSPrintInfo localizedPaperName] to determine if the default paper size is "US Letter" or "A4".

NSPrintInfo * printInfo = [NSPrintInfo sharedPrintInfo]; [printInfo localizedPaperName]

How can I get the iOS device to tell me if the default paper size is "US Letter" or "A4"?


Solution

  • Since nobody has suggested a better way, I looked up in which countries US letter is used and started checking against this list, by getting the NSLocaleCountryCode

     [[[NSLocale currentLocale] objectForKey:NSLocaleCountryCode] isEqualToString:@"US"]||
            [[[NSLocale currentLocale] objectForKey:NSLocaleCountryCode] isEqualToString:@"CA"]||
            [[[NSLocale currentLocale] objectForKey:NSLocaleCountryCode] isEqualToString:@"MX"]||
            [[[NSLocale currentLocale] objectForKey:NSLocaleCountryCode] isEqualToString:@"CU"]||
            [[[NSLocale currentLocale] objectForKey:NSLocaleCountryCode] isEqualToString:@"DO"]||
            [[[NSLocale currentLocale] objectForKey:NSLocaleCountryCode] isEqualToString:@"GT"]||
            [[[NSLocale currentLocale] objectForKey:NSLocaleCountryCode] isEqualToString:@"CR"]||
            [[[NSLocale currentLocale] objectForKey:NSLocaleCountryCode] isEqualToString:@"SV"]||
            [[[NSLocale currentLocale] objectForKey:NSLocaleCountryCode] isEqualToString:@"HN"]||
            [[[NSLocale currentLocale] objectForKey:NSLocaleCountryCode] isEqualToString:@"BO"]||
            [[[NSLocale currentLocale] objectForKey:NSLocaleCountryCode] isEqualToString:@"CO"]||
            [[[NSLocale currentLocale] objectForKey:NSLocaleCountryCode] isEqualToString:@"VE"]||
            [[[NSLocale currentLocale] objectForKey:NSLocaleCountryCode] isEqualToString:@"PH"]||
            [[[NSLocale currentLocale] objectForKey:NSLocaleCountryCode] isEqualToString:@"CL"]