Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
Questions about iOS development and PDF
  • Page:
  • 1

TOPIC:

Is it posible to indent text? 8 years 9 months ago #9315

  • Gracanin
  • Gracanin's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 25
  • Thank you received: 0
I would like to indent text of my PDF document on left and/or right side because on some devices I get cropped text when the zoom scale is set to the minimal possible value.
Height of document is equal to the height of the screen and I want to leave it that way....

Is there any simple solution for this problem?

Please Log in or Create an account to join the conversation.

Is it posible to indent text? 8 years 9 months ago #9323

  • support
  • support's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 692
  • Thank you received: 59
The only way I could think is to adopt the page reflow rendering mode.
Using that you will completely loose images layout and text boxes while text formatting will stay unchanged.

PDF files aren't flexible as a Word document could be so, if above text reflow mode won't help you, the alternative way is that you will redesign your document to fix as best as possible devices' screen,
The following user(s) said Thank You: Gracanin

Please Log in or Create an account to join the conversation.

Is it posible to indent text? 8 years 8 months ago #9333

  • Gracanin
  • Gracanin's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 25
  • Thank you received: 0
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...

Please Log in or Create an account to join the conversation.

Last edit: by Gracanin.
  • Page:
  • 1
Powered by Kunena Forum