Knowledge Base - Migration from 3.61 to 3.70 beta 1 (iOS)

To include successfully in your project the new Radaee's SDK with annots' properties and meta feature follow these steps:

1. Replace PDFView and PDFLib classes;

2. Edit OnAnnotClicked, OnAnnotEditBox, OnAnnotCommboBox, OnAnnotList and OnAnnotTapped in PDFLayoutViewDelegate as follow:

- (void)OnAnnotClicked:(PDFAnnot *)annot :(CGRect)annotRect :(float)x :(float)y;

- (void)OnAnnotEditBox:(PDFAnnot *)annot :(CGRect)annotRect :(NSString *)editText :(float)textSize;

- (void)OnAnnotCommboBox:(PDFAnnot *)annot :(CGRect)annotRect :(NSArray *)dataArray selected:(int)index;

- (void)OnAnnotList:(PDFAnnot *)annot :(CGRect)annotRect :(NSArray *)dataArray selectedIndexes:(NSArray *)indexes;

- (void)OnAnnotTapped:(PDFAnnot *)annot atPage:(int)page atPoint:(CGPoint)point; //before it was didTapAnnot

3. Add in your project "AnnotProp" folder from "Modules" as group reference and include these classes in your View Controller:

#import "MenuAnnotOp.h"

#import "PDFDialog.h"

#import "DlgMeta.h"

#import "DlgAnnotPopText.h"

#import "DlgAnnotPropComm.h"

#import "DlgAnnotPropMarkup.h"

#import "DlgAnnotPropLine.h"

#import "DlgAnnotPropIcon.h"

4. Implement OnAnnotProp method in your View Controller:

-(void)OnAnnotProp:(PDFAnnot *)annot

{

    int atype = [annot type];

    if(atype == 4 || atype == 8)//line and polyline

    {

        NSArray *views = [[NSBundle mainBundle] loadNibNamed:@"DlgAnnotPropLine" owner:self options:nil];

        DlgAnnotPropLine *view = [views lastObject];

        [view setBackgroundColor:[UIColor colorWithRed:0.5f green:0.5f blue:0.5f alpha:1]];

        

        PDFDialog *dlg = [[PDFDialog alloc] init:view :CGRectMake(0, 0, 200, 293) :YES :^(BOOL is_ok){

            if (is_ok)

            {

                [view updateAnnot];

                [self->m_view vAnnotEnd];

                [self->m_view vUpdateAnnotPage];

                [self->m_view setModified:YES force:NO];

            }

            else

                [self->m_view vAnnotEnd];

        }];

        [view setAnnot:annot :dlg];

        [self presentViewController:dlg animated:NO completion:nil];

    }

    else if(atype >= 9 && atype <= 12)//markup

    {

        NSArray *views = [[NSBundle mainBundle] loadNibNamed:@"DlgAnnotPropMarkup" owner:self options:nil];

        DlgAnnotPropMarkup *view = [views lastObject];

        [view setBackgroundColor:[UIColor colorWithRed:0.5f green:0.5f blue:0.5f alpha:1]];

        

        PDFDialog *dlg = [[PDFDialog alloc] init:view :CGRectMake(0, 0, 200, 123) :YES :^(BOOL is_ok)

        {

            if (is_ok)

            {

                [view updateAnnot];

                [self->m_view vAnnotEnd];

                [self->m_view vUpdateAnnotPage];

                [self->m_view setModified:YES force:NO];

            }

            else

                [self->m_view vAnnotEnd];

        }];

        [view setAnnot:annot :dlg];

        [self presentViewController:dlg animated:NO completion:nil];

    }

    else if(atype == 1 || atype == 17)//sticky note and file attachment.

    {

        NSArray *views = [[NSBundle mainBundle] loadNibNamed:@"DlgAnnotPropIcon" owner:self options:nil];

        DlgAnnotPropIcon *view = [views lastObject];

        [view setBackgroundColor:[UIColor colorWithRed:0.5f green:0.5f blue:0.5f alpha:1]];

        

        PDFDialog *dlg = [[PDFDialog alloc] init:view :CGRectMake(0, 0, 200, 229) :YES :^(BOOL is_ok){

            if (is_ok)

            {

                [view updateAnnot];

                [self->m_view vAnnotEnd];

                [m_view vUpdateAnnotPage];

                [self->m_view setModified:YES force:NO];

            }

            else

                [self->m_view vAnnotEnd];

        }];

        [view setAnnot:annot :dlg];

        [self presentViewController:dlg animated:NO completion:nil];

    }

    else

    {

        NSArray *views = [[NSBundle mainBundle] loadNibNamed:@"DlgAnnotPropComm" owner:self options:nil];

        DlgAnnotPropComm *view = [views lastObject];

        [view setBackgroundColor:[UIColor colorWithRed:0.5f green:0.5f blue:0.5f alpha:1]];

        [view hasFill:(atype != 15)];

 

        PDFDialog *dlg = [[PDFDialog alloc] init:view :CGRectMake(0, 0, 200, 229) :YES :^(BOOL is_ok){

            if (is_ok)

            {

                [view updateAnnot];

                [self->m_view vAnnotEnd];

                [m_view vUpdateAnnotPage];

                [self->m_view setModified:YES force:NO];

            }

            else

                [self->m_view vAnnotEnd];

        }];

        [view setAnnot:annot :dlg];

        [self presentViewController:dlg animated:NO completion:nil];

    }

}

5. Implement OnMeta method in your View Controller:

-(void)OnMeta

{

    CGRect rect = m_view.frame;

    NSArray *views = [[NSBundle mainBundle] loadNibNamed:@"DlgMeta" owner:self options:nil];

    DlgMeta *view = [views lastObject];

    //rect = view.frame;

    //"Title",

    //"Author",

    //"Subject",

    //"Keywords",

    //"Creator",

    //"Producer",

    //"CreationDate",

    //"ModDate"

    [view setTitle:[m_doc meta:@"Title"]];

    [view setAuthor:[m_doc meta:@"Author"]];

    [view setSubject:[m_doc meta:@"Subject"]];

    [view setKeywords:[m_doc meta:@"Keywords"]];

 

    [view setBackgroundColor:[UIColor colorWithRed:0.5f green:0.5f blue:0.5f alpha:1]];

    PDFDialog *dlg = [[PDFDialog alloc] init:view :CGRectMake(0, 0, rect.size.width * 0.8, 244) :YES :^(BOOL is_ok){

        if (!is_ok) return;//ok button pressed?

        [self->m_doc setMeta:@"Title" :view.title];

        [self->m_doc setMeta:@"Author" :view.author];

        [self->m_doc setMeta:@"Subject" :view.subject];

        [self->m_doc setMeta:@"Keywords" :view.keywords];

        [self->m_view setModified:YES force:NO];

    }];

    [self presentViewController:dlg animated:NO completion:nil];

}

 

Applies To

RadaeePDF SDK for iOS

Details

Created : 2020-05-27 16:11:15, Last Modified : 2020-05-27 16:56:20