Skip to main content

BaseExtractor

It is the extractor with greater granularity, basically it is a wrapper for the native module, it is exported along with the other resources, allowing new extractors to be built that extend it.

canIExtract

This function returns a Promise<boolean> that determine if you received an uri from Android Intent and perform data extraction.

async function canIExtract(): Promise<boolean>

setUri

This function receive a string that represents a path of PDF file and use it to perform data extraction, and returns a uri generated from received path.

async function setUri(path: string): Promise<string>

getUri

This function returns a Promise<string | undefined> that contains uri received from Android Intent.

async function getUri(): Promise<string | undefined>

isEncrypted

This function returns a Promise<boolean> that determine if a pdf file is encrypted and need a password to be read.

async function isEncrypted(): Promise<boolean>

getNumberOfPages

This function returns a Promise<number> that determine the pdf file number of pages.

async function getNumberOfPages(): Promise<boolean>

getText

This function returns all pdf file text as Promise<string[]>, where each array position is one line of the pdf file.

async function getText(password?: string): Promise<string[]>
nametypedefaultrequireddescription
passwordstring | undefinedundefinedfalsepassword of pdf file

getTextWithPattern

This function returns a pdf file text that matches with passed pattern, as Promise<string[]>, where each array position is one match of the pdf file text.

async function getTextWithPattern(
pattern: string | string[],
password?: string
): Promise<string[]>
nametypedefaultrequireddescription
patternstring | string[]nonetruepattern to find match with pdf`s text
passwordstring | undefinedundefinedfalsepassword of pdf file