Joel,

The PDF is a binary data format. So, trying to decode with an ASCII encoding vonverter would result in data loss.
I recommend processing it as mere bytes without mapping to a string.

Aki from iPhone


On 2008/10/28, at 21:43, Joel Norvell <[EMAIL PROTECTED]> wrote:

Dear Cocoa-dev People,

I have a file with some metadata prepended to a pdf.

I want to strip the metadata off and display the pdf.

I was trying to do this:

- (void) loadFromPath: (NSString *) path
{
 NSData *myData = [NSData dataWithContentsOfFile:path];

 NSString *myStr = [[NSString alloc] initWithData:pdfData
                                     encoding:NSASCIIStringEncoding];

 // I strip off the metadata here, leaving the pdfStr.

 // Nothing I've tried here has worked:
 NSData * myNewData = [pdfStr dataUsingEncoding: ???];

 // Display the pdf here...
}

How can I get this to work?

Sincerely,

Joel Norvell





_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/aki%40apple.com

This email sent to [EMAIL PROTECTED]
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to