Schneller Start
Beobachtet Folders
Job Kontrolle
In PDF Drucken

Entwicklers API
Developer's API

Developers can write simple code to convert EPS and PS files to PDF using the PStill engine. Here's How:

1. Include the following Protocol as a .h file:

#import <Foundation/Foundation.h>

#define PStillFilterServer    ([NSString stringWithFormat:@"PStillFilterServer-%@",[[NSProcessInfo processInfo] hostName]])

@protocol PStillVended

// 0 = success     anything else = failure
// caller's responsibility to make sure outputFile is writeable and not existing!
- (int)convertFile:(NSString *)inputFile toPDFFile:(NSString *)outputFile deleteInput:(BOOL)deleteInput;

// you can also convert many files to one single PDF with this one:
- (int)convertFiles:(NSArray *)fullPathsToFiles toPDFFile:(NSString *)outputFile deleteInput:(BOOL)deleteInput;

// when licensing is done, this will return YES, otherwise NO
- (BOOL)applicationReadyForInput;

// for jobs to show a preview from a thread
- (void) showImageFile:(NSString *)file width:(int)width height:(int)height isEPS:(BOOL)isEPS rotation:(int)rotation pageNumber:(int)pageNumber;


2. Call the Engine

This is sample calling code which checks to be sure PStill is launched, the licensing is finished and it's ready to go. If the conversion is successful, "0" is returned:

#import <AppKit/AppKit.h>
#import <Foundation/Foundation.h>
#import <stdio.h>
#import <mach/mach.h>
#import <servers/bootstrap.h>
#include <unistd.h>

#import "PStillVendedProtocol.h"

#define USAGE NSLog(@"This Print Filter requires PStill for Mac OS X by Stone Design and Frank Siegert. Visit to download and full information.")

#define WAKE_UP_WAIT    5

static id<PStillVended> lookupPStillDOServer(void) {
port_t sendMachPort;
NSDistantObject *rootProxy = nil;
id<PStillVended> result;

// First, try look up PStill's DO object in the bootstrap server.
// This is where the app registers it by default.
if ((BOOTSTRAP_SUCCESS == bootstrap_look_up(bootstrap_port, (char *)([PStillFilterServer cString]), &sendMachPort)) && (PORT_NULL != sendMachPort)) {
NSConnection *conn = [NSConnection connectionWithReceivePort:[NSPort port] sendPort:[NSMachPort portWithMachPort:sendMachPort]];
rootProxy = [conn rootProxy];

// If the previous call failed, the following might succeed if the user
// logged in is running Terminal with the PublicDOServices user default
// set.
if (!rootProxy) {
rootProxy = [NSConnection rootProxyForConnectionWithRegisteredName:PStillFilterServer host:@""];

// We could also try to launch PStill at this point, using
// the NSWorkspace protocol.

if (!rootProxy) {
if (![[NSWorkspace sharedWorkspace] launchApplication:@"PStill"]) {
return nil;
rootProxy = [NSConnection rootProxyForConnectionWithRegisteredName:PStillFilterServer host:@""];

if (!rootProxy) {
fprintf(stderr,"Can't connect to PStill\n");
return nil;

[rootProxy setProtocolForProxy:@protocol(PStillVended)];
result = (id<PStillVended>)rootProxy;
return result;

(BOOL)convertFile(NSString *inputFile) {
NSString *outputFile;

id<PStillVended> theProxy = lookupPStillDOServer();
// if we can't find it, bail:
if (theProxy != nil) {
// if she's not launched, we'll wait until she's licensed or they give up on licensing:
while(![theProxy applicationReadyForInput])
[NSThread sleepUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];

outputFile = nextTempUnique([[inputFile lastPathComponent]stringByDeletingPathExtension]);

if ([theProxy convertFile:inputFile toPDFFile:outputFile deleteInput:NO] == 0) {
return YES;

} else NSLog(@"Couldn't convert %@",inputFile);

} else NSLog(@"Couldn't connect to PStill");
return NO;

NOTE: Obviously, you must have a licensed version of PStill for this to work! If you just want to test PStill in demo mode, remove the "while (![theProxy applicationReadyForInput]) statement.

Zurück | Anfang | Index | Weiter
©2000 Stone Design top