[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

EPS from view failed

From: Stefan Urbanek
Subject: EPS from view failed
Date: Fri, 17 Feb 2006 11:10:29 +0100
User-agent: Internet Messaging Program (IMP) 3.2.2


I try to create an EPS image like this:

#import <Foundation/NSAutoreleasePool.h>
#import <Foundation/NSString.h>
#import <AppKit/NSApplication.h>
#import <AppKit/NSBezierPath.h>
#import <AppKit/NSColor.h>
#import <AppKit/NSGraphics.h>
#import <AppKit/NSView.h>

NSView  *view = nil;

#define WIDTH 100
#define HEIGHT 100

@interface MyView:NSView
@implementation MyView
- (void)drawRect:(NSRect)rect
        [NSBezierPath strokeRect:NSMakeRect(10,10,80,80)];

void create_image(void)
        view = [[MyView alloc] initWithFrame:NSMakeRect(0,0,WIDTH,HEIGHT)];

void write_image(void)
        NSData *data;

        data = [view dataWithEPSInsideRect:[view bounds]];
        NSLog(@"EPS Data length: %i",[data length]);
        [data writeToFile:@"image.eps" atomically:YES];

int main(void)
        NSAutoreleasePool *pool = [NSAutoreleasePool new];

        [NSApplication sharedApplication];



        [view release];
        [pool release];
        return 0;

The output is:

2006-02-17 11:05:44.000 test.exe[192] Creating image
2006-02-17 11:05:44.000 test.exe[192] Creating a default printer since no
printer has been set in the user defaults (under the GSLPRPrinters key).
2006-02-17 11:05:44.000 test.exe[192] Printing to C
2006-02-17 11:05:45.000 test.exe[192] unable to set blocking mode - An invalid
argument was supplied.

2006-02-17 11:05:45.000 test.exe[192] EPS Data length: 0
2006-02-17 11:05:45.000 test.exe[192] Done
The file 'c' is writable by someone other than its owner.
Ignoring it.

What does "unable to set blocking mode - An invalid argument was supplied." mean
and why EPS data length is zero?

Stefan Urbanek

First they ignore you, then they laugh at you, then they fight you, then
you win.
- Mahatma Gandhi

reply via email to

[Prev in Thread] Current Thread [Next in Thread]