Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

question on using CGPSConverter



> Hi all,
> 
> i have a question on the use of CGPSConverter.
> 
> What i want to do:
> create an obc-j commandline tool with 2 arguments:
> argument 1 : the path to a eps-file i want to convert
> argument 2 : the path where i want the created pdf to be saved
> 
> Below you'll find the code fragment i use.
> However, this code fragment does not seem to work:
> - i can create a valid callbacks object 
> - i can create a valid converter object
> - i can create a valid provider and consumer object
> - i get converted == true at the end
> 
> but there is never a file fysically created at the location i want.
> In fact the is nog file created at all.
> 
> What am i missing ?
> What could i be doing wrong ?
> 
> Kind regards,
> Koen Gogne 
> 
> #-------------------------------------------------------------------------
> 
> int main (int argc, const char * argv[]) {
>     NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
>     NSLog([[NSString alloc] initWithFormat:@"Converting file '%s' to '%s'.",argv[1], argv[2]]);
> 
> 	bool converted = FALSE;
> 	
> 	NSString *inpath;
> 	NSString *outpath;
> 
> 	struct CGPSConverterCallbacks *callbacks = malloc(sizeof(struct CGPSConverterCallbacks));
> 	callbacks->version = '0';
> 	callbacks->beginDocument = nil;
> 	callbacks->endDocument = nil;
> 	callbacks->beginPage = nil;
> 	callbacks->endPage = nil;
> 	callbacks->noteProgress = nil;
> 	callbacks->noteMessage = nil;
> 	callbacks->releaseInfo = nil;
> 	
> 	CGPSConverterRef converter = CGPSConverterCreate(NULL,callbacks,NULL);
> 
> 	inpath = [[[NSString alloc] initWithFormat:@"%s",argv[1]]  stringByExpandingTildeInPath];
>     NSURL *inurl = [NSURL fileURLWithPath:inpath];
> 	CGDataProviderRef provider = CGDataProviderCreateWithURL((CFURLRef)inurl);
> 	
> 	outpath = [[[NSString alloc] initWithFormat:@"%s",argv[2]]  stringByExpandingTildeInPath];
> 	NSURL *outurl = [NSURL fileURLWithPath: outpath];
> 	CGDataConsumerRef consumer = CGDataConsumerCreateWithURL((CFURLRef)outurl);
> 
> 	converted = CGPSConverterConvert(converter,provider,consumer,NULL);
> 	
> 	if (converted) {
> 		NSLog(@"Postscript file converted.\n");
> 		CGDataConsumerRetain(consumer);
> 	} else {
> 		NSLog(@"Converting postscript failed.\n");
> 	}
> 
> 	CGDataProviderRelease(provider);
> 	CGDataConsumerRelease(consumer);
> 
>     [pool release];
> 	
> 	return 1;	
> }
> 
> 
> 


This e-mail, and any attachments thereto, is intended only for use by the addressee(s) named herein and may contain legally privileged and/or confidential information and/or information protected by intellectual property rights. 
If you are not the intended recipient, please note that any review, dissemination, disclosure, alteration, printing, copying or transmission of this e-mail and/or any file transmitted with it, is strictly prohibited and may be unlawful. 
If you have received this e-mail by mistake, please immediately notify the sender and permanently delete the original as well as any copy of any e-mail and any printout thereof. 
We may monitor e-mail to and from our network. 

NSS nv
Tieltstraat 167
8740 Pittem
Belgium


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/xcode-users/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.