TPPDFAsync is an extension to the TPPDF framework that adds asynchronous capabilities using Combine. It allows you to generate PDF documents asynchronously by leveraging the power of Combine framework in iOS applications.
TPPDFAsync can be easily integrated into your iOS project using Swift Package Manager. Simply add TPPDFAsync as a dependency in your Package.swift file:
dependencies: [
.package(url: "https://github.com/techprimat/TPPDFAsync", from: "0.0.1")
]
Alternatively, you can also use CocoaPods by adding the following line to your Podfile
:
pod 'TPPDFAsync', '~> 0.0.1'
Using TPPDFAsync is straightforward. Follow these steps to generate a PDF asynchronously:
import TPPDF
import TPPDFAsync
PDFDocument
as you would with TPPDF:let document = PDFDocument(format: .a4)
document.add(text: "Hello, TPPDFAsync!")
document.add(image: UIImage(named: "exampleImage"))
// Customize layout, styling, headers, footers, etc.
PDFAsyncGenerator
and use the generateAsyncTask()
method to generate the PDF asynchronously:let generator = PDFAsyncGenerator(document: document)
generator.generateURLAsyncTask(filename: "document.pdf")
.sink(receiveCompletion: { completion in
switch completion {
case .finished:
// PDF generation completed successfully
break
case .failure(let error):
// Handle any errors that occurred during PDF generation
print("PDF generation failed: \(error)")
}
}, receiveValue: { url in
// Handle the generated PDF file URL
print("PDF generated successfully: \(url)")
})
.store(in: &cancellables)
For more detailed usage instructions, refer to the TPPDF documentation.
TPPDFAsync is released under the MIT License. See the LICENSE file for more information.
Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request.
TPPDFAsync is built upon the foundation of the TPPDF framework. Many thanks to the TPPDF contributors for their efforts in creating and maintaining the core library.
link |
Stars: 4 |
Last commit: 2 days ago |
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics