在离子应用程序中显示pdf [英] Display pdf inside an ionic app

查看:128
本文介绍了在离子应用程序中显示pdf的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个带离子框架的应用程序,我需要显示一个pdf。

Im developing an app with ionic framework and I need to display a pdf.

我在网上看了很多,发现这个指令要用

I've read a lot on the internet and found this directive to use

https://github.com/winkerVSbecks/ angular-pdf-viewer

问题是我在将指令与我的离子应用程序集成时遇到问题。

The problem is that I'm having problems to integrate the directive with my ionic app.

我已经完成了指示的步骤:

I've done the indicated steps:


  1. bower install angular-pdf-viewer

  1. bower install angular-pdf-viewer

包括lib,AngularJS和PDFJS的路径:(这里我更改了路径)

Include the path to the lib, AngularJS and PDFJS: (here I changed the paths)

  <script src="lib/pdfjs-dist/build/pdf.js"></script>
  <script src="lib/angular/angular.js"></script>
  <script src="lib/angular-pdf-viewer/dist/angular-pdf-viewer.min.js"></script>


  • 在您的角应用程序中包含lib作为依赖项:

  • Include the lib as a dependency in your angular app:

      var app = angular.module('App', ['pdf']);
    


  • 然后我把它放在模板中

    <pdf-viewer    delegate-handle="my-pdf-container"    url="www.publishers.org.uk/_resources/assets/attachment/full/0/2091.pdf" scale="1"    show-toolbar="true"    ></pdf-viewer>
    

    但我收到此错误


    [$ parse:syntax]语法错误:令牌'pdf'是表达式第64列的意外标记

    [$parse:syntax] Syntax Error: Token 'pdf' is an unexpected token at column 64 of the expression

    我做错了什么?

    提前致谢!

    推荐答案

    我相信url值意味着指向你的范围。所以假设你有$ scope.pdf =你想要的网址,你可以在标签中做url =pdf。

    I believe the url value is meant to point to your scope. So given that you have $scope.pdf = "the url you want", you would do url="pdf" in the tag.

    这篇关于在离子应用程序中显示pdf的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆