diff --git a/ChangeLog b/ChangeLog index 037a99bf2..5d0fcf03d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2013-02-28 Eric Wasylishen + + * Source/GSPDFPrintOperation.m: Update -_print and -deliverResult + to match GSEPSPrintOperation to get the class to at least partly + working. Output is appearing up-side-down for me though. + 2013-02-23 Fred Kiefer * Source/NSindow.m (-setDelegate:): Don't unregister delegate diff --git a/Source/GSPDFPrintOperation.m b/Source/GSPDFPrintOperation.m index 0721cbcb5..df9ab2e28 100644 --- a/Source/GSPDFPrintOperation.m +++ b/Source/GSPDFPrintOperation.m @@ -38,6 +38,7 @@ #import #import #import +#import #import "AppKit/NSPrintInfo.h" #import "AppKit/NSView.h" #import "GNUstepGUI/GSPDFPrintOperation.h" @@ -101,7 +102,9 @@ return _context; info = [[self printInfo] dictionary]; - + + // TODO: Instead we should support NSGraphicsContext writing to an + // NSMutableData directly. [info setObject: _path forKey: @"NSOutputFile"]; @@ -114,14 +117,31 @@ - (void) _print { + // TODO: Copied-and-pasted from GSEPSPrintOperation. Factor out. + + /* Save this for the view to look at. Seems like there should + be a better way to pass it to beginDocument */ + [[[self printInfo] dictionary] setObject: [NSValue valueWithRect: _rect] + forKey: @"NSPrintSheetBounds"]; + + [_view beginDocument]; + [_view beginPageInRect: _rect + atPlacement: NSMakePoint(0,0)]; + [_view displayRectIgnoringOpacity: _rect inContext: [self context]]; + + [_view endPage]; + [_view endDocument]; + + // FIXME: Output comes out up-side-down } - (BOOL)deliverResult { - if (_data != nil && _path != nil && [_data length]) - return [_data writeToFile: _path atomically: NO]; - // FIXME Until we can create PDF we shoud convert the file with GhostScript + if (_data != nil && _path != nil) + { + [_data setData: [NSData dataWithContentsOfFile: _path]]; + } return YES; }