Forum


Replies: 2   Views: 498
Read image alt text in header and footer
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by bkidd  · 20-07-2021 - 15:29

I'm currently using the technique described here to read image alt text from the document:  https://www.phpdocx.com/en/forum/default/topic/1944

I would also like to read image alt text from the header and footer but when I set the target to 'header' or 'footer' I don't get nodes back from getDocxPathQueryInfo.

Is there any way to read image alt text from header and footer?

Thank you

Posted by admin  · 20-07-2021 - 16:34

Hello,

DOCXPath supports setting document, header and footer as targets. We have done some tests and we get the information from headers and footers correctly. Since phpdocx 10 the Indexer class also extracts alt text and description contents from images.

We recommend you to download the latest version available on MY PHPDOCX page after login, and check the included sample Docxpath/getDocxPathQueryInfo/sample_4.php that gets information from headers:

$referenceNode = array(
    'target' => 'header',
    'type' => 'paragraph',
);

$queryInfo = $docx->getDocxPathQueryInfo($referenceNode);

var_dump($queryInfo);

If you open a support ticket (https://www.phpdocx.com/support) attaching the DOCX you are using, the dev team will generate a custom script using your document.

Regards.

Posted by bkidd  · 20-07-2021 - 18:38

Thank you, I will try that.