Is there a way to programmatically extract the sections from a PDF document using Apple developer frameworks?

Is there a way to programmatically extract sections or sections of text from a PDF document using Apple frameworks? Like PDFKit or Core Graphics, CGPDFDocument? I'm able to extract pages of text or all pdf text using PDFKit but I'd like to be able to extract corresponding sections of text.

Is there a way to programmatically extract the sections from a PDF document using Apple developer frameworks?
 
 
Q