我使用 pdf2json 生成了一个json文件;现在我想使用 FlexpaperViewer 在html 4中渲染它,但是当我尝试时,我得到一个'未捕获的TypeError:无法调用方法'替换'未定义。
这是html:
<!DOCTYPE html/>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>FlexPaper</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="initial-scale=1,user-scalable=no,maximum-scale=1,width=device-width" />
<style type="text/css" media="screen">
html, body { height:100%; }
body { margin:0; padding:0; overflow:auto; }
#flashContent { display:none; }
</style>
<link href="../../FlexPaper/flexpaper.css" rel="stylesheet" type="text/css" />
<script src="../../FlexPaper/jquery-1.10.2.js" type="text/javascript"></script>
<script src="../../FlexPaper/jquery.extensions.min.js" type="text/javascript"></script>
<script src="../../FlexPaper/flexpaper.js" type="text/javascript"></script>
<script src="../../FlexPaper/flexpaper_handlers.js" type="text/javascript"></script>
<script src="../../FlexPaper/flexpaper_handlers_debug.js" type="text/javascript"></script>
<script src="../../FlexPaper/FlexPaperViewer.js" type="text/javascript"></script>
</head>
<body>
<div id="documentViewer" class="flexpaper_viewer" style="position:absolute;left:10px;top:10px;width:770px;height:500px"></div>
<script type="text/javascript">
$(document).ready(function () {
$('#documentViewer').FlexPaperViewer(
{ config: {
//DOC : escape(getDocumentUrl(startDocument)),
JSONFile: "../../FlexPaper/paper.js",
Scale: 0.6,
ZoomTransition: 'easeOut',
ZoomTime: 0.5,
ZoomInterval: 0.1,
FitPageOnLoad: true,
FitWidthOnLoad: false,
FullScreenAsMaxWindow: false,
ProgressiveLoading: false,
MinZoomSize: 0.2,
MaxZoomSize: 5,
SearchMatchAll: false,
RenderingOrder: 'html,html5',
ViewModeToolsVisible: true,
ZoomToolsVisible: true,
NavToolsVisible: true,
CursorToolsVisible: true,
SearchToolsVisible: true,
key: '***',
localeDirectory: "../../FlexPaper/locale/",
localeChain: 'en_US'
}
}
);
});
</script>
</body>
你可以帮我找到我做错的事吗?提前谢谢。
答案 0 :(得分:1)
在Firefox中,您会收到不同的错误:
TypeError: this.pageImagePattern is undefined
它认为FlexPaper的HTML版本需要PDF和JSON文件来呈现。
因此,您还需要指定:
PDFFile: "../../sth",
这将使其正常工作。 干杯! :)