手机端 阅读 pdf 文件 touchPDF.js
生活随笔
收集整理的這篇文章主要介紹了
手机端 阅读 pdf 文件 touchPDF.js
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
touchpdf 中文API
下載地址: http://github.com/loicminghetti/touchpdf/archive/master.zip
一款在手機端 閱讀pdf 文件的 js庫,能夠 通過滑動進行 pdf 預覽 翻頁
TouchPDF是一個jQuery插件,它使用pdf.js短語和呈現支持觸摸手勢和自動頁面選項卡的Web PDF查看器。
依賴關系:
- PDF.js
- jQuery touchSwipe插件
- jQuery panzoom插件
- jQuery mousewheel插件
特征:
PDF可以使用滾動,兩個手指捏,+/-鍵和工具欄按鈕進行縮放。
PDF可以使用一根手指刷。
在文檔頂部的工具欄,標題,頁碼和下一頁/上一頁和縮放的按鈕。
如何使用它:
1.將jQuery TouchPDF的CSS文件加載到文檔的頭部。
<link href="jquery.touchPDF.css" rel="stylesheet">2.在文檔末尾加載jQuery庫,jQuery TouchPDF插件和其他必需的資源。
<script src="pdf.compatibility.js"></script><script src="pdf.js"></script><script src="//code.jquery.com/jquery-1.11.2.min.js"></script><script src="jquery.touchSwipe.min.js"></script><script src="jquery.touchPDF.js"></script><script src="jquery.panzoom.js"></script><script src="jquery.mousewheel.js"></script>3.為Web PDF查看器創建一個DOM元素。
<div id="myPDF"></div>4.初始化插件并指定要在DOM元素中顯示的PDF文件的路徑。
$(function() {$("#myPDF").pdf( {source: "demo.pdf",// MORE SETTINGS HERE} ); });5.插件參數設置
// Path of PDF file to display source: null,// Title of the PDF to be displayed in the toolbar title: "TouchPDF",// Array of tabs to display on the side. tabs: [],// Default background color for all tabs. // Available colors are "green", "yellow", "orange", "brown", // "blue", "white", "black" and you can define your own colors with CSS. tabsColor: "beige",// Disable zooming of PDF document. disable<a href="http://www.jqueryscript.net/zoom/">Zoom</a>: false,// Disable swipe to next/prev page of PDF document. disableSwipe: false,// Disable all internal and external links on PDF document disableLinks: false,// Disable the arrow keys for next/previous page and +/- for zooming disableKeys: false,// Force resize of PDF viewer on window resize redrawOnWindowResize: true,// Show a toolbar on top of the document with title, // page number and buttons for next/prev pages and zooming showToolbar: true,// A handler triggered when PDF document is loaded loaded: null,// A handler triggered each time a new page is displayed changed: null,// Text or HTML displayed on white page shown before document is loaded loadingHeight: 841,// Height in px of white page shown before document is loaded loadingWidth: 595,// Width in px of white page shown before document is loaded loadingHTML: "Loading PDF"總結
以上是生活随笔為你收集整理的手机端 阅读 pdf 文件 touchPDF.js的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Thinkpad E431 加 ssd
- 下一篇: 实达已经不是那个实达,而叶成辉还是那个叶