Nefertiti

1.2.0

A searchable PDF maker.
D-Integral/Nefertiti

Nefertiti

Nefertiti by Dmytro Skorokhod is an open source iOS library for making searchable PDF documents from photos. It takes an array of UIImage objects and returns a file confirming to NefertitiFileProtocol.

Nefertiti is available as a Swift package. To start using the library add package dependancy, then import Nefertiti and NefertitiFile into your source code file.

Here is an example of usage Nefertiti with VisionKit:

    import Nefertiti
    import NefertitiFile
    import VisionKit

    let nefertiti: NefertitiPDFMakerProtocol = NefertitiSearchablePDFMaker()
    var pdfDocumentSavingOperation: ((any NefertitiFileProtocol) -> ())?

    extension VisionDocumentCameraManager: VNDocumentCameraViewControllerDelegate {
        func documentCameraViewController(_ controller: VNDocumentCameraViewController,
                                      didFinishWith scan: VNDocumentCameraScan) {
          var pageImages = [UIImage]()
        
          for pageIndex in 0 ..< scan.pageCount {
              pageImages.append(scan.imageOfPage(at: pageIndex))
          }
        
          nefertiti.generatePdfDocumentFile(from: images) { file, error in
              if let error = error {
                  debugPrint(error)
                  return
              }

              guard let file = file,
                    let pdfDocumentSavingOperation = pdfDocumentSavingOperation else { return }
            
              pdfDocumentSavingOperation(file)
          }
       }
    }

Read the NefertitiFile library documentation for the examples of NefertitiFileProtocol usage.

Description

  • Swift Tools 5.9.0
View More Packages from this Author

Dependencies

Last updated: Mon May 12 2025 22:16:16 GMT-0900 (Hawaii-Aleutian Daylight Time)