PresentationTextExtractor class
Plugin for extracting text from the PowerPoint 97-2003 and Microsoft Office Open XML presentations.
process(inputPath: string, textExtractionMode: number): Promise<SlideText[]>
Extracts text from the input presentation using the specified mode.
Parameters:
| Name | Type | Description |
|---|---|---|
| inputPath | string | The name of the input presentation file. |
| textExtractionMode | number | Text extraction mode (see TextExtractionMode) |
Example
const rawSlidesText = await slidize.PresentationTextExtractor.process("presentation.pptx", slidize.TextExtractionMode.Unarranged);
for (let i = 0; i < rawSlidesText.length; i++)
{
const slideText = rawSlidesText[i];
// Print the text extracted from the slide
console.log(slideText.text);
// Print the text extracted from the master of the slide
console.log(slideText.masterText);
// Print the text extracted from the layout of the slide
console.log(slideText.layoutText);
// Print the notes text extracted from the slide
console.log(slideText.notesText);
// Print the comments text extracted from the slide
console.log(slideText.commentsText);
}
process(inputBuffer: Buffer, textExtractionMode: number): Promise<SlideText[]>
Extracts text from the input presentation using the specified mode.
Parameters:
| Name | Type | Description |
|---|---|---|
| inputBuffer | Buffer | Input presentation as a Buffer. |
| textExtractionMode | number | Text extraction mode (see TextExtractionMode) |
Example
const buffer = await fs.readFile("presentation.pptx");
const arrangedSlidesText = await slidize.PresentationTextExtractor.process(buffer, slidize.TextExtractionMode.Arranged);
for (let i = 0; i < arrangedSlidesText.length; i++)
{
const slideText = arrangedSlidesText[i];
// Save the arranged text extracted from the slide
console.log(slideText.text);
}