diff --git a/ChangeLog b/ChangeLog index e75183653..e980a459b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2011-03-13 Eric Wasylishen + + * Source/NSPrintPanel.m: + * Printing/GSCUPS/GSCUPSPrintOperation.m: + * Printing/GSLPR/GSLPRPrintOperation.m: Allow saving a print + job as a PDF. + 2011-03-13 Wolfgang Lux * Source/NSSpellChecker.m (-_findNext:, -_learn:, -_forget:, diff --git a/Printing/GSCUPS/GSCUPSPrintOperation.m b/Printing/GSCUPS/GSCUPSPrintOperation.m index 16f5ed719..a4c6972d0 100644 --- a/Printing/GSCUPS/GSCUPSPrintOperation.m +++ b/Printing/GSCUPS/GSCUPSPrintOperation.m @@ -117,9 +117,17 @@ [info setObject: _path forKey: @"NSOutputFile"]; - - [info setObject: NSGraphicsContextPSFormat - forKey: NSGraphicsContextRepresentationFormatAttributeName]; + + if ([[[_path pathExtension] lowercaseString] isEqualToString: @"pdf"]) + { + [info setObject: NSGraphicsContextPDFFormat + forKey: NSGraphicsContextRepresentationFormatAttributeName]; + } + else + { + [info setObject: NSGraphicsContextPSFormat + forKey: NSGraphicsContextRepresentationFormatAttributeName]; + } _context = RETAIN([NSGraphicsContext graphicsContextWithAttributes: info]); diff --git a/Printing/GSLPR/GSLPRPrintOperation.m b/Printing/GSLPR/GSLPRPrintOperation.m index cd6325c5f..f5b8315cc 100644 --- a/Printing/GSLPR/GSLPRPrintOperation.m +++ b/Printing/GSLPR/GSLPRPrintOperation.m @@ -139,10 +139,18 @@ [info setObject: _path forKey: @"NSOutputFile"]; + + if ([[[_path pathExtension] lowercaseString] isEqualToString: @"pdf"]) + { + [info setObject: NSGraphicsContextPDFFormat + forKey: NSGraphicsContextRepresentationFormatAttributeName]; + } + else + { + [info setObject: NSGraphicsContextPSFormat + forKey: NSGraphicsContextRepresentationFormatAttributeName]; + } - [info setObject: NSGraphicsContextPSFormat - forKey: NSGraphicsContextRepresentationFormatAttributeName]; - _context = RETAIN([NSGraphicsContext graphicsContextWithAttributes: info]); return _context; diff --git a/Source/NSPrintPanel.m b/Source/NSPrintPanel.m index ade2f5c16..ab2a2a919 100644 --- a/Source/NSPrintPanel.m +++ b/Source/NSPrintPanel.m @@ -254,7 +254,7 @@ static NSPrintPanel *shared_instance; NSSavePanel *sp; sp = [NSSavePanel savePanel]; - [sp setRequiredFileType: @"ps"]; + [sp setAllowedFileTypes: [NSArray arrayWithObjects: @"pdf", @"ps", nil]]; result = [sp runModal]; if (result == NSOKButton) {