Adjust the screen in pdfViewer

假装没事ソ 提交于 2019-12-06 05:51:27

To increase the view size of PDFVIEWER.jar Create an ABSTRACT CLASS or just copy the code HERE

For me I name the class "PdfViewerActivities"

To get the desired amount of zoom please refer to the logcat which is trigger when you click the button of zoom icon in the pdf page

"PDFVIEWER ST='reading page 1, zoom:0.435'"

In private static final float STARTZOOM = 0.435f; change the value based on your desired zoom amount

and then extend the class to your main class

public class PDF_Reader extends PdfViewerActivities{

@Override
public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
}

@Override
public int getPreviousPageImageResource() {
  return R.drawable.left_arrow;
}

@Override
public int getNextPageImageResource() {
  return R.drawable.right_arrow;
}

@Override
public int getZoomInImageResource() {
    return R.drawable.zoom_in;
}

@Override
public int getZoomOutImageResource() {
  return R.drawable.zoom_out;
}

@Override
public int getPdfPasswordLayoutResource() {
  return R.layout.pdf_file_password;
}

@Override
public int getPdfPageNumberResource() {
    return R.layout.dialog_pagenumber;
}

@Override
public int getPdfPasswordEditField() {
   return R.id.etPassword;
}

@Override
public int getPdfPasswordOkButton() {
   return R.id.btOK;
}

@Override
public int getPdfPasswordExitButton() {
  return R.id.btExit;
}

@Override
public int getPdfPageNumberEditField() {
   return R.id.pagenum_edit;
}
}

Hope this helps everyone ^_^v

Finally I used code from APV PDF Viewer that works well.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!