Knowledge Base - How to add text to a PDF (iOS)

This article shows how to add text to a pdf.

To use these methods you need a Premium license.

- (void)vAddText:(NSString *)text


    //prepare to write texts

    PDFPageContent *content = [[PDFPageContent alloc] init];

    [content gsSave];

    PDFMatrix *mat = [[PDFMatrix alloc] init:1 :1 :100 :200];

    [content gsCatMatrix:mat];


    PDFPage *page = [m_doc page:0];


    PDFDocFont *dfont = [m_doc newFontCID:@"Helvetica" :1 | 8];//bold and embed in horizontal writing


    PDF_PAGE_FONT rfont = [page addResFont:dfont];


    [content textBegin];


    [content textSetFont:rfont :20]; //set font and size

    [content setFillColor:0xff0000];

    [content setStrokeCap:2];

    [content textSetCharSpace:0];

    [content textSetWordSpace:0.3f];

    [content textSetLeading:20];

    [content textSetRenderMode:2]; //fill and stroke

    [content textSetHScale:120]; //set horizontal scale

    [content drawText:text];

    [content textEnd];

    [content gsRestore];


    [page addContent:content :true];


    [m_view vRenderSync:0];

    [self refresh];


    [m_doc save];



Applies To

RadaeePDF SDK for iOS


Created : 2015-08-25 12:26:08, Last Modified : 2017-07-14 09:19:38

Order history

Login to handle your order history.