Re: Unable to generate a PDF from textual data
Re: Unable to generate a PDF from textual data
- Subject: Re: Unable to generate a PDF from textual data
- From: Charles Steinman <email@hidden>
- Date: Fri, 14 Nov 2008 11:05:25 -0800 (PST)
Are you certain that faxMsgData is valid PDF data? It sounds like it isn't being recognized as a PDF.
Cheers,
Chuck
--- On Fri, 11/14/08, Lee, Frederick (Ric) <email@hidden> wrote:
> From: Lee, Frederick (Ric) <email@hidden>
> Subject: Unable to generate a PDF from textual data
> To: email@hidden
> Date: Friday, November 14, 2008, 10:16 AM
> Greetings:
>
> I'm trying to create a PDF from a NSString; but
> I'm not getting anything.
>
> What am I doing wrong?
>
>
>
> - (id)initWithData:(NSDictionary *)inData {
>
> self = [super init];
>
> if (self != nil) {
>
> self.faxHistoryItemDict = inData;
>
> // 1) Create the PDF Data Source:
>
> CFDataRef faxMsgData =
> (CFDataRef)[[self.faxHistoryItemDict
> objectForKey:@"msg"] dataUsingEncoding:
> NSUTF8StringEncoding];
>
> CGDataProviderRef faxMsgDataRef =
> CGDataProviderCreateWithCFData(faxMsgData);
>
> // 2) Create the PDF doc:
>
> self.faxPDFDoc =
> CGPDFDocumentCreateWithProvider(faxMsgDataRef); // I
> don't get a PDF here.
>
>
>
> CGDataProviderRelease(faxMsgDataRef);
>
> }
>
> return self;
>
> } // end initWithData().
>
>
>
> (gdb) po faxPDFDoc
>
> Cannot access memory at address 0x0 ß ???
>
>
>
> Here's the header:
>
> @interface PDFDrawing : NSObject<QuartzViewDelegate>
> {
>
> CGPDFDocumentRef pdf;
>
> NSDictionary *faxHistoryItemDict;
>
>
>
> @private
>
> CGPDFDocumentRef faxPDFDoc;
>
>
>
> }
>
>
>
> @property(nonatomic, retain) NSDictionary
> *faxHistoryItemDict;
>
> @property(nonatomic, assign) CGPDFDocumentRef faxPDFDoc;
>
>
>
> - (id)initWithData:(NSDictionary *)inData;
>
> -(void)drawView:(QuartzView*)view
> inContext:(CGContextRef)context bounds:(CGRect)bounds;
>
>
>
> @end
>
>
>
> Regards,
>
> Ric.
>
>
>
>
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> 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:
>
> This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden