使用jquery mobile打开pdf [英] open pdf using jquery mobile

查看:512
本文介绍了使用jquery mobile打开pdf的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用jQuery mobile打开PDF。
我正在使用worklight 6.o并且适配器返回PDF的内容,
var content ='some PDF content' - 我将从apadapter获得
contentType ='PDF ' - 我将从适配器获得。
我有内容和contentType,基于此,我需要打开PDF,如果contentType是PDF或单词,如果contentType是msword。

How to open a PDF using jQuery mobile. I'm using worklight 6.o and the adapter returns the content of PDF, var content = 'some PDF content' -- which i will get from the apadapter contentType = 'PDF' -- which i will get from the adapter. I have content and contentType, based on this, I need to open the PDF, if the contentType is PDF or word,if the contentType is msword.

function onSuccessDownloadAdapter (results) {
          try {
              if(results.invocationResult.isSuccessful){
              if(results.invocationResult.stat == "ok"){
                  var content = results.invocationResult.content;
                  var contentType = results.invocationResult.contentType;
                 var embed = '<embed src=data:'+contentType+';base64,'+content+'>';
                     $("#dataContent").append(embed);
              }
              else{
                  alert("Stat fail:"+message);
                  WL.Logger.debug("Stat fail:"+message);    
              }
              }
              else{
                  alert("No connection");
                  WL.Logger.debug("downlaodAdapter onSuccess:: noConnection");  

              }  
              busyInd.hide();
          } catch (e) {
              busyInd.hide();
            displayError(e.toString());
          }

}

这在浏览器中有效,但是不在手机中。

This is working in browser, but not in mobile.

推荐答案

请看一下: https://github.com/markeeftb/FileOpener

插件打开处理文档预览的外部应用程序。

Plugin opens external application which handles the preview of the document.

这篇关于使用jquery mobile打开pdf的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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