March 27, 2024
How to read the text from Docx in php
TechTechInfo.com » How to read the text from Docx in php

How to read the text from Docx in php

convert docx to text

 

Here you will learn about how to read the docx content in php. This library will return the text of the docx so that you can apply different operations on the given text.

Here are the steps to convert docx to the text

 

Requirements

 

* php installation

* Apache

* vsCode

* Download library (https://github.com/jpwright/debcite/blob/master/class.pdf2text.php) 

# Step1:

Download the Doc2Txt.php and past this in the root folder

# Step2:

create an index.php file in the same folder and paste the below code in the file

<?php
include ('Doc2Txt.php');
$docObj = new Doc2Txt('test.docx');
$txt = $docObj->convertToText();
echo $txt;

# Step3:

Put a docx file in the same folder and change the file in the index.php file

 

# Step4:

Now hit the index file on the browser you will get the docx content in text format.

Join the discussion

Translate »