一、Flash Builder 安装4.6下载地址,需要用迅雷下载,破解只需要替代一个amtlib.dll文件即可二、安装参照flexpaper二次开发入门教程.pdf三、建立项目下载大神已经写好的二
一、Flash Builder 安装
4.6下载地址,需要用迅雷下载,破解只需要替代一个amtlib.dll文件即可
二、安装参照
flexpaper二次开发入门教程.pdf
三、建立项目
下载大神已经写好的二次开发文件包
四、开始修改
五、编译导出,也是看第二步的pdf教程
六、使用,超过5页的就在固定高度显示,少于5页加高高度一次性显示完成
<?#上传pdf的时候,用php获取一些pdf的总页数,方便设置swf的高度$width='915px';$height='1000px';if($news['pdf_pages']<=5){ $width='898px'; $height = ($news['pdf_pages']*1267).'px';}?><script type="text/javascript"> $('#documentViewer').FlexPaperViewer( { config : { SWFFile : 'uploadfile/doc/<?=$pathinfo['filename']?>.swf', Scale : 1.5, ZoomTransition : 'easeOut', ZoomTime : 0.5, ZoomInterval : 0.2, FitPageOnLoad : false, FitWidthOnLoad : false, FullScreenAsMaxWindow : false, ProgressiveLoading : false, MinZoomSize : 0.2, MaxZoomSize : 5, SearchMatchAll : false, InitViewMode : 'Portrait', RenderingOrder : 'flash,html', StartAtPage : '', ViewModeToolsVisible : true, ZoomToolsVisible : true, NavToolsVisible : false, CursorToolsVisible : true, SearchToolsVisible : true, WMode : 'window' } } );</script>#获取php总页数函数function getPdfPages($path){ if(!file_exists($path)) return array(false,"文件/"{$path}/"不存在!"); if(!is_readable($path)) return array(false,"文件/"{$path}/"不可读!"); // 打开文件 $fp=@fopen($path,"r"); if (!$fp) { return array(false,"打开文件/"{$path}/"失败"); }else { $max=0; while(!feof($fp)) { $line = fgets($fp,255); if (preg_match('///Count [0-9]+/', $line, $matches)){ preg_match('/[0-9]+/',$matches[0], $matches2); if ($max<$matches2[0]) $max=$matches2[0]; } } fclose($fp); // 返回页数 return array(true,$max); }}
备注
以上涉及到的软件都上传到了百度网盘 /linux/centos/doc2view/二次开发flexpaper 中
参考:http://www.cnblogs.com/xcong/p/3142155.html
https://flowpaper.com/api/
js交互
//需要放到事件中,不然无法获取,有个onDocumentLoaded事件没搞定$('#c').click(function(){ var swf = findSWF("documentViewer"); var pages = swf.getTotalPages(); //获取总页数 swf.gotoPage(pages); //跳转到最后一页})function findSWF(movieName) { if (navigator.appName.indexOf("Microsoft")!= -1) { return window[movieName]; } else { return document[movieName]; }}