前端应用pdfobject.js处置惩罚pdf文件

插件申明

插件pdfobject.js官方链接:https://pdfobject.com/

插件引入

a、建立盒子,可以对个盒子example1经由过程style增加款式

<style>
.pdfobject-container {
    height: 30rem;
    border: 1rem solid rgba(0,0,0,.1);
}
</style>
<div id="example1"></div>

b、引入插件

<script src="js/pdfobject.min.js"></script>
<script>
    PDFObject.embed(
        "/pdf/sample-3pp.pdf",
        "#example1"
     );
</script>

初始化设置

PDFObject.embed(url [string], target [mixed], options [object])

a、url [string]即为pdf的链接;
b、target [mixed] 指定dom节点;
c、options [object]初始化设置选项

  • page(初始化的时刻跳转到第几页)
  • id(给嵌入元素一个id值)
  • width(嵌入元素的宽度)
  • height(嵌入元素的高度)
  • fallbackLink(回调链接,在浏览器不支持的情况下,授与一段提醒笔墨和文件下载链接)
  • pdfOpenParams(许可运用adobe开放参数)

开放接口view:

  基本参数: Fit
            FitH
            FitH, top
            FitV
            FitV, left
            FitB
            FitBH
            FitBH, top
            FitBV
            FitBV, left
  至此不在逐一引见:请检察文档https://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/pdf_open_parameters.pdf
  • PDFJS_URL(pdf.js的展现页面链接)
  • forcePDFJS(是不是许可整合pdf.js,true为许可)

参考链接:
1、https://pdfobject.com/
2、pdf官方开放接口: https://www.adobe.com/content…
3、https://blog.csdn.net/badgirl…

    原文作者:sourcenode
    原文地址: https://segmentfault.com/a/1190000019174138
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞