在手机端展现PDF是移动开发者的一大痛点html
目前在PC端展现PDF有较多的解决方案,好比:git
<embed type="application/pdf" src="test.pdf" width="100%" height="100%"/>
这里再也不赘述使用方法,网上一大堆github
那么在手机端展现pdf就成了一个难题,尤为是在微信上(兼容性无力吐槽),通过一番研究,在GitHub上发现了pdf2htmlEX这个神器!bash
GitHub连接先来一发:https://github.com/coolwanglu/pdf2htmlEX微信
Demo再来一发,注意url,是xxx.html! http://coolwanglu.github.io/pdf2htmlEX/demo/geneve.htmlapp
ok,相信你看了Demo基本已经被它的显示效果惊呆了,下面咱们来看一下它的使用吧:ui
官方文档:https://github.com/coolwanglu/pdf2htmlEX/wiki/Buildingurl
Mac OS X能够使用brew来安装spa
brew install pdf2htmlEX
Windows在以上连接最底部有下载连接。命令行
官方文档:https://github.com/coolwanglu/pdf2htmlEX/wiki/Quick-Start
安装好pdf2htmlEX后,使用命令行切换到pdf文件目录。
这里简单介绍几个命令:
pdf2htmlEX --zoom 1.3 pdf/test.pdf
pdf2htmlEX --embed cfijo --dest-dir out pdf/test.pdf
除了以上的命令之外,还有不少实用方式,好比截取片断转换、修改像素等,这里再也不赘述,感兴趣的能够去官网查看。