An open API service indexing awesome lists of open source software.

https://github.com/d-integral/nefertiti

A searchable PDF maker.
https://github.com/d-integral/nefertiti

pdf pdf-generation

Last synced: 4 months ago
JSON representation

A searchable PDF maker.

Awesome Lists containing this project

README

          

# 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:

```Swift
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.