Class PdfTextExtractor
Builds PdfTextPages for the pages of a PdfVectorDocument: the native replacement of PDFium's FPDFText_LoadPage. Fonts are resolved once per document, and recent pages are kept within a character budget, since search and selection read the same pages repeatedly. Prefetch(PdfVectorDocument, int) builds a page's text in the background (after the page is drawn, say) so that the first selection or search on it does not wait.
public static class PdfTextExtractor
- Inheritance
-
PdfTextExtractor
- Inherited Members
Methods
Invalidate(PdfVectorDocument)
Drops the cached text pages of a document (after it was changed in memory), and its pending prefetches.
public static void Invalidate(PdfVectorDocument document)
Parameters
documentPdfVectorDocument
IsLoaded(PdfVectorDocument, int)
True when the page's text is built and kept (a load returns at once).
public static bool IsLoaded(PdfVectorDocument document, int pageNumber)
Parameters
documentPdfVectorDocumentpageNumberint
Returns
LoadPage(PdfVectorDocument, int, CancellationToken)
The text page of a page (1-based).
public static PdfTextPage LoadPage(PdfVectorDocument document, int pageNumber, CancellationToken cancellationToken = default)
Parameters
documentPdfVectorDocumentpageNumberintcancellationTokenCancellationToken
Returns
LoadPageAsync(PdfVectorDocument, int, CancellationToken)
LoadPage(PdfVectorDocument, int, CancellationToken) off the calling thread.
public static Task<PdfTextPage> LoadPageAsync(PdfVectorDocument document, int pageNumber, CancellationToken cancellationToken = default)
Parameters
documentPdfVectorDocumentpageNumberintcancellationTokenCancellationToken
Returns
PageBox(PdfPageNode)
The page's box as PDFium reads it: the crop box within the media box.
public static PdfRect PageBox(PdfPageNode node)
Parameters
nodePdfPageNode
Returns
Prefetch(PdfVectorDocument, int)
Builds the page's text in the background, at low priority, unless it is kept already. The queue is bounded (the most recent requests win), a build never waits for the document while a page is being drawn, and requests for a document that is closed or invalidated are dropped. The page is kept like any other, within the cache's character budget.
public static void Prefetch(PdfVectorDocument document, int pageNumber)
Parameters
documentPdfVectorDocumentpageNumberint