How to create Searchable PDF using Image(with text) in macOS application?

I have been tried to rewrite using PDFOutline for searchable PDF using image(with text), but not able to generate the searchable PDF. And also I have tried vision framework to get the text and it's frame from the image.

label code, we have appended text recognition and related data into that, here is the snippet


  let outlineEntry = PDFOutline()

        if label.destination != nil {

          let destination = label.destination!

          let destinationRect = image.getBoundingBox(text:destination, pageRect:pageRect)!

          let labelLocation = NSMakePoint(destinationRect.minX, destinationRect.maxY)

          outlineEntry.destination = PDFDestination(page: page, at: labelLocation)

        } else {

          outlineEntry.destination = defaultOutlineDestination

        }

  self.pdfDocument.outlineRoot = self.outline


Then saved this pdfDocument on my local disk.



Please let me know any frameworks are available ?


Thanks in advance

Posted on Jun 3, 2024 4:07 AM

Reply
2 replies

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How to create Searchable PDF using Image(with text) in macOS application?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.