Knowledge Base - Change page size using advanced properties (iOS)

Using the Advanced properties, you can change the page dimensions, check the below code:

Note: a premium license is needed.

 

- (void)setBoxHeight:(int)height width:(int)width forPage:(int)pageno

{

    PDFPage *page = [m_doc page:pageno];

    PDFObj *obj = [m_doc advanceGetObj:[page advanceGetRef]];

    

    int count = [obj dictGetItemCount];

    

    for (int cur = 0; cur < count; cur++) {

        NSString *tag = [obj dictGetItemTag:cur];

        PDFObj *item = [obj dictGetItemByIndex:cur];

        int type = [item getType];

 

        if ([tag isEqualToString:@"MediaBox"] || [tag isEqualToString:@"CropBox"])

        {

            int arr_count = [item arrayGetItemCount];

            PDFObj *boxWidth = [item arrayGetItem:2];

            PDFObj *boxHeight = [item arrayGetItem:3];

            [boxWidth setIntVal:width];

            [boxHeight setIntVal:height];

        }

    }

    [m_doc save];

}

Applies To

RadaeePDF SDK for iOS

Details

Created : 2018-02-02 15:07:35, Last Modified : 2018-02-02 15:07:35