PdfFile
Represents a PDF file and provides methods to interact with it.
Examples
Constructors
new PdfFile()
Creates an instance of PdfFile.
Parameters
• data: Buffer
The binary data of the PDF file.
Returns
Methods
getContent()
Gets the text content of specified pages in the PDF file. Does not support links.
Parameters
• pageNumbers?: number
[]
Optional. An array of page numbers to get content from.
Returns
Promise
<PdfFileContentItem
[]>
A promise that resolves to the content of the specified pages.
Examples
pagesCount()
Gets the total number of pages in the PDF file.
Returns
Promise
<number
>
A promise that resolves to the number of pages.
Examples
search()
Searches for a string within the PDF file.
Parameters
• search: string
The string to search for.
• options?: SearchPdfConfigs
Optional. Search configuration options.
Returns
Promise
<SearchPdfResult
[]>
A promise that resolves to an array of search results.
Examples
fromUrl()
Creates a PdfFile instance from a URL.
Parameters
• url: string
The URL of the PDF file.
Returns
Promise
<PdfFile
>
A promise that resolves to a PdfFile instance.