Frequently Asked Question
How to reset zoom when changing orientation?
Last Updated a year ago
This article shows how to reset zoom when changing orientation.
You have to change the onSizeChanged method of PDFLayoutView as following:
@Override protected void onSizeChanged( int w, int h, int oldw, int oldh ) { super.onSizeChanged(w,h,oldw, oldh); if(m_layout != null && m_status != STA_ANNOT && w > 0 && h > 0) { m_layout.vResize(w, h); PDFLayout.PDFPos pdfPos = m_layout.vGetPos(0,0); m_layout.vZoomSet(m_layout.vGetWidth()/2, m_layout.vGetHeight()/2, pdfPos, 1); PDFGotoPage(m_pageno); if( m_goto_pos != null ) { m_layout.vSetPos(0, 0, m_goto_pos); m_goto_pos = null; invalidate(); } } }
Remember that this implementation resets the view scale even if you are in zoom state.