Hi, I would like to add a PDFView to another view. But if my root view is layer backed I see nothing (just white). If I disable layer backing, pdf appears fine.

My code is:
NSString *path = [[NSBundle mainBundle] pathForResource:fileName ofType:nil inDirectory:folder]; PDFDocument* pdf = [[[PDFDocument alloc] initWithURL:[NSURL fileURLWithPath:path]] autorelease]; PDFView *pdfView = [[[PDFView alloc] initWithFrame:[[pdf pageAtIndex: 0] boundsForBox:kPDFDisplayBoxCropBox]] autorelease];
[pdfView setDocument:pdf];
[pdfView goToFirstPage:self];
[pdfView setDisplayMode:kPDFDisplaySinglePage];
[uiView addSubview:pdfView];
[uiView setWantsLayer:YES];


Is this normal behaviour? Is there anyway to display PDF's in a layer backed view? I only want to display a single PDF page, no need to select text, navigate pages, scroll etc. Just static display.

I was using the following code to draw the PDF into an image and display that, but then when the view is scaled it doesn't display very sharp (not vector anymore).
PDFPage* page = [pdf pageAtIndex:0];
NSData* rawData = [page dataRepresentation];
NSImage* image = [[[NSImage alloc] initWithData:rawData] autorelease];

Cheers,

Memo.

_______________________________________________

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 arch...@mail-archive.com

Reply via email to