PDFView in layer backed view appears white
PDFView in layer backed view appears white
- Subject: PDFView in layer backed view appears white
- From: Memo Akten <email@hidden>
- Date: Mon, 6 Apr 2009 14:31:00 +0100
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 (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