问题
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