手机端 阅读 pdf 文件 touchPDF.js

1 篇文章 0 订阅
1 篇文章 0 订阅

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"
  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
pdf.jspdf.worker.js是两个 JavaScript 文件,用于在网页中呈现 PDF 文件pdf.js 提供了解析 PDF 文件的主要功能,而pdf.worker.js提供了在解析过程中必要的工作线程。 pdf.js的特点在于,它使得在网页中呈现PDF文件变得非常容易。pdf.js 基于 HTML5 技术和 WebGL,可以在各种现代浏览器中呈现PDF文件pdf.js还支持许多PDF文件的高级特性,例如交互式表单,内部链接,嵌入式JavaScript等。这使得PDF在网页中的呈现更加具有交互性和可操作性。 pdf.worker.js的作用在于,它提供了解析PDF文件所必须的工作线程。这些工作线程可以在后台执行,并且可以处理PDF文件的各种特性。此外,pdf.worker.js还可以提高PDF文件的打开速度和响应速度,因为它使得对PDF文件的解析变得更加高效。 虽然pdf.jspdf.worker.js提供了许多便利,但是它们仍然有一些局限性。由于它们是基于Web技术开发的,因此在处理大型和复杂的PDF文件时可能会存在性能问题。另外,由于它们是在网页中呈现PDF文件,因此缺乏PDF文件的一些安全性能,例如数字签名和安全访问控制等。 总之,pdf.jspdf.worker.js是非常实用的JavaScript文件,可用于在网页中呈现PDF文件。它们提供了许多高级特性和便利,但仍然存在一些局限性。对于大多数用户来说,使用这两个文件仍然是一个非常好的选择。
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值