DImuthuUpe / AndroidPdfViewer

Android view for displaying PDFs rendered with PdfiumAndroid
Apache License 2.0
8.17k stars 1.91k forks source link

Can't disable zoom out #232

Open Papabrose opened 7 years ago

Papabrose commented 7 years ago

Hello,

Maybe I'm not sure of how to do it but I'm trying to open a PDF document zoomed in to pageWidth and then I want to make it so the user can not zoom out anymore but can only zoom in. Is this possible with the current code or is that something you would have to add?

Thanks

1stmetro commented 7 years ago

simple enough, see below.

float MAXIMUM_ZOOM = 10; float MINIMUM_ZOOM = 1;

Papabrose commented 7 years ago

Hi thank you for the quick response!

Would I use the "setMaxZoom" and "setMinZoom" methods to do this?

Edit: I tried
pdfView.setMaxZoom(10); pdfView.setMinZoom(1);

but it didn't work.

@1stmetro anymore thoughts on this? I still couldn't get this to disable zooming out

1stmetro commented 7 years ago

grab the source edit constants file for pinchZoom, min mid max zoom is double taps

Papabrose commented 7 years ago

can something be put into the framework so that I don't have to download the source and make edits myself to it? I would prefer not to have to manage the library myself. Thanks!

barteksc commented 7 years ago

Just use Constants.Pinch.MAXIMUM_ZOOM and MINIMUM_ZOOM

Papabrose commented 7 years ago

I apologize, I'm not sure what you mean but "Just use Constants.Pinch.MAXIMUM_ZOOM and MINIMUM_ZOOM" Just use them how? Do I set them some how or do I use them in a set method somewhere? An example would be helpful. Thanks in advance!

barteksc commented 7 years ago

Sorry, in version 2.5.0 you can do it even easier, set Constants.Pinch.MAXIMUM_ZOOM and MINIMUM_ZOOM to desired values

nuwanchamara commented 6 years ago

If there is more than one pdf viewers all the pdf viewers affect when set Constants.Pinch.MAXIMUM_ZOOM and MINIMUM_ZOOM. How can i disable only one view's zoom? if you can provide some access to DragPinchManager class enable() disable() methods via PDFView class . we may be able to disable the pinch zoom ... If you can make private DragPinchManager dragPinchManager;

in PDFView class to

public DragPinchManager dragPinchManager;

or put some getter to PDFView class i may me able to disable the zoom

1stmetro commented 6 years ago

You create multiple pdfvew and reference to one pdfview

nuwanchamara commented 6 years ago

I have two pdf views. one for display thumbnails and one for display page. i want to disable the zoom functionality in thumbnail view. When i set Constants.Pinch.MAXIMUM_ZOOM and MINIMUM_ZOOM . It will affect on both pdf views.

alierdogan7 commented 6 years ago

I think downloading the library and modifying it according to your preferences is the best option.

wonday commented 6 years ago

+1, need enableZoom interface.

kaling852 commented 5 years ago

or you can setOnTouchListener to null, if you are simply just displaying the pdf without interaction.

pdfView.setOnTouchListener(null);

bonyhardian commented 4 years ago

Add this code in onCreate: Constants.Pinch.MINIMUM_ZOOM = 1; Constants.Pinch.MAXIMUM_ZOOM = 1;

For disable double tap: pdfView.fromAsset(SAMPLE_FILE) ....... .enableDoubletap(false) .load();