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

TOPIC:

Add a button on top side corner of the pdf page. 7 years 2 months ago #11842

  • Rajat Singla
  • Rajat Singla's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 8
  • Thank you received: 0
Hii.

Can we add a button on the top side corner of the pdfPage.
if yes, then how?

Thanks.

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

Add a button on top side corner of the pdf page. 7 years 2 months ago #11844

  • emanuele
  • emanuele's Avatar
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 580
  • Thank you received: 67
Hi,

you can consider the pdf page like a normal view and add objects with standard development methods.

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

Add a button on top side corner of the pdf page. 7 years 2 months ago #11845

  • Rajat Singla
  • Rajat Singla's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 8
  • Thank you received: 0
Hii, thanks for the reply.

I tried that, but when i need to add button where the page starts.

Please look at the attachment below.

I need to add the button at position 2.
But using above approach, button is set at posiiton 1.
Attachments:

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

Last edit: by Rajat Singla.

Add a button on top side corner of the pdf page. 7 years 2 months ago #11848

  • emanuele
  • emanuele's Avatar
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 580
  • Thank you received: 67
Hi,

to get the correct position you should calculate it with something like:
//Get the vPage 
PDFVPage *vvpage = [m_view vGetPage:m_cur_page];
    //Get the page position
    int x = [vvpage GetVX:[m_view vGetX]];
    int y = [vvpage GetVY:[m_view vGetY]];
    //Get the correct position using scale
    float logicx = x/m_scale;
    float logicy = y/m_scale;
    //Use contentOffset to get the view position on the scrollView
    CGRect exampleRect = CGRectMake(logicx + self.contentOffset.x, logicy + self.contentOffset.y, 50, 50);

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

Add a button on top side corner of the pdf page. 7 years 2 months ago #11849

  • Rajat Singla
  • Rajat Singla's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 8
  • Thank you received: 0
Thanks, that was some good advise.

But i need a solution where we can add button on PDFVPage itself, not on the view it is contained in.

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

Add a button on top side corner of the pdf page. 7 years 2 months ago #11865

  • emanuele
  • emanuele's Avatar
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 580
  • Thank you received: 67
Hi,
PDFVPage is a NSObject and not contains a view, but draw the page content on a canvas using CG methods.
If you want to add objects on a page, you should use annotations or add subviews on the scrollview with the sample code of the previous post.

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

  • Page:
  • 1
Powered by Kunena Forum