Adjust the screen in pdfViewer

蹲街弑〆低调 提交于 2020-01-02 13:21:27

问题


I have an application that views pdfs, the problem is that the pdf out of the screen, and if I zoom out the pdf is not focused.

I am Using code from this SO answer.

Read PDF Using PDFViewer

Any ideas?

Thank you


回答1:


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




回答2:


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



来源:https://stackoverflow.com/questions/11259131/adjust-the-screen-in-pdfviewer

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