在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:Alua-Kinzhebayeva/iOS-PDF-Reader开源软件地址:https://github.com/Alua-Kinzhebayeva/iOS-PDF-Reader开源编程语言:Swift 97.3%开源软件介绍:PDFKIT for iOS 11+ appsDeprecated in favor ofiOS-PDF-ReaderPDF Reader for iOS written in Swift
Requirements
InstallationCocoaPodsTo install it, simply add the following line to your Podfile: pod 'PDFReader' You will also need to make sure you're opting into using frameworks: use_frameworks! Then run CarthageTo install it, simply add the following line to your Cartfile:
Run UsageImport Frameworkimport PDFReader Create a PDFDocumentFrom a file URLlet documentFileURL = Bundle.main.url(forResource: "Cupcakes", withExtension: "pdf")!
let document = PDFDocument(url: documentFileURL)! From a remote URLlet remotePDFDocumentURLPath = "http://devstreaming.apple.com/videos/wwdc/2016/201h1g4asm31ti2l9n1/201/201_internationalization_best_practices.pdf"
let remotePDFDocumentURL = URL(string: remotePDFDocumentURLPath)!
let document = PDFDocument(url: remotePDFDocumentURL)! From Datalet document = PDFDocument(fileData: fileData, fileName: "Sample PDF")! Display a PDFDocumentlet readerController = PDFViewController.createNew(with: document)
navigationController?.pushViewController(readerController, animated: true) CustomizationsController TitlePDFViewController.createNew(with: document, title: "Favorite Cupcakes") Background Colorcontroller.backgroundColor = .white Action Button Image and ActionAvailable Action Styles/// Action button style
public enum ActionStyle {
/// Brings up a print modal allowing user to print current PDF
case print
/// Brings up an activity sheet to share or open PDF in another app
case activitySheet
/// Performs a custom action
case customAction((Void) -> ())
} let actionButtonImage = UIImage(named: "cupcakeActionButtonImage")
PDFViewController.createNew(with: document, title: "Favorite Cupcakes", actionButtonImage: actionButtonImage, actionStyle: .activitySheet)
Override the default backbutton/// Create a button to override the default behavior of the backbutton. In the below example we create a cancel button which will call our myCancelFunc method on tap.
let myBackButton = UIBarButtonItem(title: "Cancel", style: .done, target: self, action: #selector(self.myCancelFunc(_:)))
/// Provide your button to createNew using the backButton parameter. The PDFViewController will then use your button instead of the default backbutton.
PDFViewController.createNew(with: document, title: "Favorite Cupcakes", backButton: myBackButton)
Do not load the thumbnails in the controllerlet controller = PDFViewController.createNew(with: document, isThumbnailsEnabled: false) Change scroll direction of the pages from left to right to top to bottomcontroller.scrollDirection = .vertical AcknowledgementsInspired by PDF Reader https://github.com/vfr/Reader and Apple's example on TiledScrollView |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论