<!--
{
  "availability" : [
    "macCatalyst: -",
    "macOS: 10.0.0 - 10.9.0"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSPrinter/stringForKey:inTable:",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSPrinter(im)stringForKey:inTable:"
  },
  "title" : "stringForKey:inTable:"
}
-->

# stringForKey:inTable:

Returns the first occurrence of a value associated with specified key.

```
- (NSString *) stringForKey:(NSString *) key inTable:(NSString *) table;
```

## Parameters

`key`

The key whose value you want.

`table`

The name of a table from the printer’s PPD file.

## Return Value

The value for the specified key, or `nil` if the key is not in the table. The returned string may also be empty.

## Discussion

If `key` is a main keyword only, and if that keyword has options in the PPD file, this method returns an empty string. Use [`stringListForKey:inTable:`](/documentation/AppKit/NSPrinter/stringListForKey:inTable:) to retrieve the values for all occurrences of a main keyword.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)