Sunday, 15 May 2011

cocoa - Objective C Printing: How to set header content? -


I want to print a specific NSView. When I do this, I want to add content to the header of the print page.

For example, if a cat's picture is in the NSV, when I suppress the print, the print preview appears with the cat's picture I want the print to be a cat's picture form In, with caption: "Cat" in the title, which I do not want to appear on the original NSV.

In addition, if this is possible, then

thanks!

You can overwrite the method - (NSAttributedString *) page header See document in the code> NSView subclasses

Note that the headers are generated only when the user is in default with the key NSPrintHeaderAndFooter value.

For images, they can be added using an NSAttributedString using a NSTextAttachment .


No comments:

Post a Comment