I found the solution to this problem in adjusting PDFView's frame to fit the screen width.
I change the PDFView's frame (to be equal to pdfBounds) on open and on every autorotate event with the following methods:
- (BOOL)needsToArrangeToWidth:(CGSize)PDFSize {
CGSize screenSize = [UIScreen mainScreen].bounds.size;
float r = PDFSize.height / screenSize.height;
return PDFSize.width / r > screenSize.width;
}
-(void)refreshScreenBounds
{
CGSize screenSize = [UIScreen mainScreen].bounds.size;
CGSize PDFSize = CGSizeMake([m_doc pageWidth:0], [m_doc pageHeight:0]);
if ([self isPortrait] && [self needsToArrangeToWidth:PDFSize]) {
float c = screenSize.width / PDFSize.width;
float height = PDFSize.height * c;
float delta = fmaxf((screenSize.height - height) / 2, 0);
pdfBounds = CGRectMake(0, delta, screenSize.width, height);
} else {
pdfBounds = CGRectMake(0, 0, screenSize.width, screenSize.height);
}
}
However, now paging is a way slower than before. I cannot figure out why, so will you please help me with some suggestions..?
I am assuming that the problem can be caused by extra resizing during page rendering because PDF size is adjusted by height by default..? When the device is in landscape mode, everything renders fine and quickly...