How to reset to "default" zoom

I’m using v8.1.2 of the iOS SDK and looking for help with what I think is a zoom issue.

TLDR: When closing a document and opening a new document using the same controller, what is the magic incantation to make the new document “fit just right” in the controller?

I am inheriting from PTDocumentController, and I am reusing that view controller for any doc that I want to view. i.e.

  1. When a user first taps on a doc thumbnail in my UI, I create a PTDocumentController and use that to open and display the full doc. Looks amazing; the document is displayed at exactly the right zoom level and I didn’t even do anything to make that happen.
  2. When the user “exits” the PTDocumentController, I close the document but I keep the controller “alive” so that I can reuse it…
  3. When the user taps on a second thumbnail, I reuse that controller and simply call openDocument with the new document.

And that’s when I run into trouble. It’s almost like the controller has decided what zoom level it wants to use for that first document, and then it keeps that zoom level for the second document.

I’ve tried tinkering with “pdfViewCtrl.zoom” and “pdfViewCtrl.setZoomX” with various degrees of interesting results, but I’m clearly doing something wrong.

As always, thank you for the amazing help you give. :slight_smile:


Thank you for getting in touch with us about this.
Are you able to share a video or images showing the behaviour you’re describing as well as the expected behaviour, i.e. what you would expect to see when opening different documents?

You could try specifying the page view mode whenever you open a document:

The default view mode for a PTDocumentController is e_trn_fit_width which fits the page width to the viewer. The default reference page view mode however is e_trn_zoom which persists the user’s current zoom across e.g. page turns.
Are you able to get your desired behaviour by setting these two properties to your preferred view modes?

Nice! Setting the pageViewMode to e_trn_fit_width does exactly what I want. Thank you!!

Great! I’m glad to hear that worked for you :slight_smile:
No problem at all and please do get in touch with any other questions or comments and we’ll try to help in any way we can.