Search results

Extract Text in JavaScript PDF Viewer control

02 Feb 2023 / 1 minute to read

To extract text in Syncfusion PDF viewer, you can use the isExtractText property and extractTextCompleted event.This allows you to extract the text from a page along with the bounds.

Here is an example of how you can use the isExtractText property and extractTextCompleted event:

Copied to clipboard
viewer.isExtractText = true;
viewer.extractTextCompleted = args => {
    //Extract the Complete text of load document
    console.log(args);
    console.log(args.documentTextCollection[1]);
    //Extract the Text data.
    console.log(args.documentTextCollection[1][1].textData);
    //Extract Text in the Page.
    console.log(args.documentTextCollection[1][1].pageText);
    //Extracts the first text of the PDF document along with its bounds
    console.log(args.documentTextCollection[1][1].textData[0].Bounds);
};

Find the sample how to extract Text