0

I need to figure out a way to get the size(dimensions) of the file being shown in the QLPreview Controller. If I use qlpreviewController.frame it just returns the dimensions of the QLPreview not the content (in my case, its a PDF).

Will I require subclassing the QLPreview or maybe use a UIWebView instead ?

My aim is that I have a subview that is draggable and I want to place it on top of the PDF file and get the relative dimensions (X and Y) with respect to the PDF that is being shown.

How should i approach this ?

This is the screenshot for the current scenarios.

enter image description here

How do I get the relative position of my draggable view(TEST) with respect to PDF ?

I have added my custom draggable view as a subview in the QLPreviewController like:

qlCntrl.view.addSubview(draggableTestView)
Umar Farooque
  • 2,049
  • 21
  • 32

1 Answers1

1

This is not possible. QLPreviewController does not expose any information about the content being shown. (In fact, the content is sometimes not actually shown by your app, but by a system service instead).

If you know you are dealing with a PDF, you can use PDFKit instead : https://developer.apple.com/documentation/pdfkit

Thomas Deniau
  • 2,488
  • 1
  • 15
  • 15