https://github.com/barteksc/AndroidPdfViewer
参考
:https://zhuanlan.zhihu.com/p/250467555
这个里面有各种属性有需要的可以进去看看,好不多说了,展示代码因为公章一些东西数据个人隐私不能展示放上去效果图但是这个很简单可以简单试一下
1.导入依赖:implementation 'com.github.barteksc:android-pdf-viewer:2.8.2'
2.初始化
3.就可以吧pdf的链接发进去调用一下就可以了
private void getPdf(String url) {
final InputStream[] input = new InputStream[1];
new AsyncTask<Void, Void, Void>() {
@SuppressLint({"WrongThread", "StaticFieldLeak"})
@Override
protected Void doInBackground(Void... voids) {
try {
input[0] = new URL(url).openStream();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(Void aVoid) {
super.onPostExecute(aVoid);
pdfView.fromStream(input[0])
.enableAnnotationRendering(true)//渲染注释(例如注释,颜色或表单)
.load();
}
}.execute();
}