Forum


Replies: 1   Views: 2015
Image file with absolute path not working
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 Jola  · 21-05-2019 - 01:40

I'm successfully converting HTML to PDF via Libreoffice but the absolute path to images are not showing up. Even with downloadImages set to true.

I'm expecting this to load in the generated PDF

<img src="https://blogix.pacificbmg.com.au/media/2616warby.jpg" width="200" height="200" />

How ever I just get a blank area for where the image is suppose to go.

My embedHTML options look like this.

 $docx->embedHTML($html, array('useHTMLExtended' => true, 'downloadImages' => true));

No error in the server side logs.

Not sure what else to try?

I have a premium licence by the way.

Posted by admin  · 21-05-2019 - 07:08

Hello,

We have run the following script:

<?php

require_once 'classes/CreateDocx.php';

$docx = new CreateDocx();

$html = '<img src="https://blogix.pacificbmg.com.au/media/2616warby.jpg" width="200" height="200" />';
$docx->embedHTML($html, array('useHTMLExtended' => true, 'downloadImages' => true));

$docx->createDocx('output');
$docx->transformDocument('output.docx', 'output.pdf');

And the image appears correctly in both documents: DOCX and PDF. Please try this script using the PHP CLI mode, do you see the image in the DOCX document? What version of LibreOffice are you using to transform the document?

Regards.