Use extractTextCompleted to extract text in ASP.NET Core PDF Viewer
Use the isExtractText property and the extractTextCompleted event to extract page text along with bounds.
The following example shows how to enable text extraction and handle the completion event:
page "{handler?}"
@model IndexModel
@{
ViewData["Title"] = "Home page";
}
<div class="text-center">
<ejs-pdfviewer id="pdfviewer" style="height:600px" resourceUrl="https://cdn.syncfusion.com/ej2/29.1.33/dist/ej2-pdfviewer-lib" documentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf" isExtractText=true>
</ejs-pdfviewer>
</div>
<script type="text/javascript">
document.addEventListener('DOMContentLoaded', function () {
var viewer = document.getElementById('pdfviewer').ej2_instances[0];
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);
};
});
</script>