Allow saving a print job as a PDF

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@32559 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Eric Wasylishen 2011-03-13 23:38:47 +00:00
parent a86694d315
commit b4956bb4ac
4 changed files with 30 additions and 7 deletions

View file

@ -1,3 +1,10 @@
2011-03-13 Eric Wasylishen <ewasylishen@gmail.com>
* Source/NSPrintPanel.m:
* Printing/GSCUPS/GSCUPSPrintOperation.m:
* Printing/GSLPR/GSLPRPrintOperation.m: Allow saving a print
job as a PDF.
2011-03-13 Wolfgang Lux <wolfgang.lux@gmail.com>
* Source/NSSpellChecker.m (-_findNext:, -_learn:, -_forget:,

View file

@ -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]);

View file

@ -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;

View file

@ -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)
{