Why doesn't pdfKit show me anything?

16 views Asked by At

I created this code to show in a NSView a PDFView: I can see that the view becomes darker in the frame I set in init, but the pdf is not shown

That's the code I wrote:

PDFView* pdfView = [[PDFView alloc] initWithFrame: 
                    self.view.bounds];
pdfView.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
pdfView.autoScales = YES ;
pdfView.displayDirection = kPDFDisplayDirectionHorizontal;
pdfView.displayMode = kPDFDisplaySinglePageContinuous;
pdfView.displaysRTL = YES ;
[pdfView setDisplaysPageBreaks:YES];
[pdfView setDisplayBox:kPDFDisplayBoxTrimBox];
[pdfView zoomIn:self];
[self.view addSubview:pdfView];

NSURL* url = [NSURL URLWithString:@"file///Users/experiment/Desktop/NSVIEW/NSVIEW/PDF/PDFKit-Basics.pdf"];

PDFDocument * document = [[PDFDocument alloc] initWithURL: url];
pdfView.document = document;
0

There are 0 answers