Knowledge Base - How to export the text from a PDF file

This article shows how to extract plain text from a single page or the complete set of pages from an opened PDF file.

Get the text from current page:

const char *fullPath = ”full_path_to_pdf”;
PDF_ERR err;
PDF_DOC m_doc = Document_open(fullPath, nil, &err);
PDF_PAGE m_page = Document_getPage(m_doc, pageno);
Page_objsStart(m_page);
NSString *pageText = Page_objsGetString(m_page, 0, Page_objsGetCharCount(m_page));
Page_close(m_page);

Where “pageno” is the number of the page.

if you want to get the text from all the pages:

const char *fullPath = ”full_path_to_pdf”;
PDF_ERR err;
PDF_DOC m_doc = Document_open(fullPath, nil, &err);
for(int i=0;i<Page_objsGetCharCount(m_page);i++)
    {
PDF_PAGE m_page = Document_getPage(m_doc, i);
      Page_objsStart(m_page);
      NSString *PDFText = Page_objsGetString(m_page, 0, Page_objsGetCharCount(m_page));
      Page_close(m_page);
    }

 

Applies To

RadaeePDF SDK for iOS

Related Articles

How to use Text to Speech

Details

Created : 2021-04-15 15:15:42, Last Modified : 2021-04-15 15:15:42