Giter VIP home page Giter VIP logo

pdf-read's Introduction

PDF-READ

PDF文档阅读器,可定位到指定的页码

使用PDF-READ

三步完成主流App框架搭建:

  • 第一步:使用CocoaPods导入PDF-READ
  • 第二步:初始化PDFReadViewController类,同时传入文档地址
  • 第三步(可选):设置阅读模式

第一步:使用CocoaPods导入PDF-READ

CocoaPods 导入

在文件 Podfile 中加入以下内容:

pod 'PDF-READ'

然后在终端中运行以下命令:

pod install

或者这个命令:

  禁止升级 CocoaPods 的 spec 仓库,否则会卡在 Analyzing dependencies,非常慢
    pod install --verbose --no-repo-update
  或者
    pod update --verbose --no-repo-update

完成后,CocoaPods 会在您的工程根目录下生成一个 .xcworkspace 文件。您需要通过此文件打开您的工程,而不是之前的 .xcodeproj。

第二步:初始化PDFReadViewController类,同时传入文档地址

    PDFReadViewController *vc = [[PDFReadViewController alloc]init];
    
    vc.fileUrl = @"http://172.16.9.159:8888/002.pdf"; //不能为空,可以为网络地址,也可以为本的存储地址
    
    [self.navigationController pushViewController:vc animated:YES];

    

第三步(可选):设置阅读模式,横向,或纵向阅读,是否翻页,设置跳转指定的页码


  vc.scrollDirection = UICollectionViewScrollDirectionHorizontal; // 横向,或纵向阅读
  
  vc.PDFPagingEnabled = YES;  // 是否翻页
  
  vc.item = @"2"; // 指定的页码
  

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.