PDFKit PDFView draw on top

Good morning,


I'm trying to draw a text on top of a PDFView when no PDF is actually displayed, in other words, I want to display text on the grey ("matte") area.

The text would be : "Drag and Drop a PDF on this area".


From the documentation: https://developer.apple.com/reference/quartz/pdfview/1505061-documentview?language=objc

it seems that the documentView is the view that I'm interested for.

However, I have no idea how to draw on it. It seems I cannot subclass it.


Any lead?


Thanks,


yellow8

Replies

Hello, if by any chance this is still a problem, what you want to do is place an NSTextField over the view. Adding text to a view above another subview is a simple NSView concern, but doesn't relate specifically to PDF-related classes. This way, you can also remove the NSTextField once a PDF has been selected.