Hi Antonio,

So I took your suggestion a little further and decided to see if [[NSGraphicsContext currentContext] attibutes] returned anything and it looks like this may do the trick...

If the print panel is not cancelled (i.e. print or save to file is clicked) then attributes are returned, otherwise none.

This gives me the type of notification I need to let my app know it's time to increment the certificate count.

The key I was returned is: _NSTiogaPrintingDestinationNames by enumerating through the attributes like so:

NSDictionary *attDictionary = [NSDictionary dictionaryWithDictionary: [[NSGraphicsContext currentContext] attributes] ];
        
        NSEnumerator *enumerator = [attDictionary objectEnumerator];
        id value;

        while ((value = [enumerator nextObject])) {
                NSLog(@"value: %@", value);
        }


Thanks!


- Will


On Jun 13, 2008, at 11:40 PM, Antonio Nunes wrote:

On 14 Jun 2008, at 05:28, Wilhelm Phillips wrote:

In order to achieve the desired result I subclassed PDFPage from PDFKit to draw the appropriate numbers and PDFDocument to apply that pageClass to any pages that I add to myPDFDocument.

An alternative may be to try to leverage NSGrahpicContext's isDrawingToScreen. A return value of NO may mean that the drawing destination is a printer, but the destination may also be a PDF or EPS file, so you need to set up a way to make sure you're not drawing to a PDF or EPS file when you call it. Once you have that set up you can add some code to your PDFPage subclass's drawWithBox: method that sets a flag to indicate the page was printed and/or its number was used.

The following link may have some more useful info:
http://frameworker.wordpress.com/2008/05/16/a-glimpse-into-pdfkit/

António

--------------------------------------------
I try to take one day at a time, but sometimes, several days attack me all at once!
--------------------------------------------



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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