In the NSPrintInfo documentation, when talking about the printSettings, it says:

"Adding keys to the dictionary is equivalent to calling the Core Printing 
function PMPrintSettingsSetValue. Your new keys are added to the current print 
settings and are saved with any user preset files generated by the Mac OS X 
printing system. Because the print settings are stored in a property list, any 
values you add to the dictionary must correspond to scalar types such as 
strings, numbers, dates, booleans, and data objects or collection types such as 
dictionaries and arrays."

I took this to mean that so long as I store my own custom settings in the 
printSettings dictionary, then if I used NSArchiver and NSUnarchiver to save 
and restore the NSPrintInfo object, that my custom items would be stored along 
with the dictionary. It appears this is not the case. If I set some custom keys 
in the print into printSettings, then do the following:

        NSPrintInfo *oldPrintInfo = [self printInfo];
        NSPrintInfo *newPrintInfo = [NSUnarchiver 
unarchiveObjectWithData:[NSArchiver archivedDataWithRootObject:[self 
printInfo]]];

My oldPrintInfo printSettings has all my added keys, and the newPrintInfo has 
only the standard keys.

I want to save my custom keys with the print info, and the documentation says 
that this happens when it is stored by the printing system, so what do I need 
to do to be able to save it in my document?

I realize that I could archive printSettings separately and re-populate the 
printinfo, but that seems pretty messy when the documentation says explicitly 
that there is a way of storing it so that the custom attributes are preserved.

Thanks

Gideon_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to