PhoneGap在线PDF [英] PhoneGap Inline PDF
问题描述
我有一些问题,让PDF在内联在PhoneGap中显示。现在,我将PDF加载到对象中,然后尝试(和失败)将对象尺寸设置为窗口高度,以便它显示全高(带应用标题和后退按钮)。
I am having some issues getting PDFs to display inline in PhoneGap. Right now, I am loading the PDF into an Object and then trying (and failing) to set the object dimensions to the window height so it's displayed full-height (with app header and back button).
Javascript:
Javascript:
<script type="text/javascript">
function jqUpdateSize(){
var pixels = $(window).height();
pixels = pixels - 48;
$('#pdfViewer').height(pixels);
};
$(document).ready(jqUpdateSize)
$(window).resize(jqUpdateSize);
</script>
HTML:
<div data-role="content" style="padding:0px; height:auto;">
<object width="100%" height="100%" data="file.PDF"></object>
</div>
这部分工作(它在我的桌面上的Chrome / FF中工作得很好) t工作在Android和iOS的应用程序。
This partially works (it works PERFECTLY in Chrome/FF on my desktop) but fails miserably and doesn't work in-app on both Android and iOS.
我看到一些关于插件ChildBrowser的文档,但我不知道它会做我想要的,
I saw some documentation about a plugin "ChildBrowser", but I'm not sure it will do what I want or how I would go about getting it setup.
推荐答案
您可以考虑使用pdf.js来渲染PDF: https://github.com/mozilla/pdf.js
You may consider using pdf.js to render PDF: https://github.com/mozilla/pdf.js
这篇关于PhoneGap在线PDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!