Replies: 1   Views: 932
Text with hyperlink change the style while convert docx to pdf
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 admin  · 22-09-2021 - 12:10


How are you adding the hyperlink and what conversion plugin are you using?

Hyperlinks allow applying custom character styles and other styles. For example:

$docx = new CreateDocx();
$linkOptions = array(
    'url'=> '',
    'color' => 'B70000',
    'underline' => 'none',
    'strikeThrough' => false,
$docx->addLink('Link to Google in red color and not underlined', $linkOptions);
$docx->transformDocument('document.docx', 'document.pdf');

The PDF is generated with the same styles as the DOCX source: the link has B70000 color and no underline.

Or using HTML:

$docx->embedHTML('<a href="" style="color: green;">My link</a>');

If you are using a template, the existing styles aren't removed unless you request it using DOCXPath, DOCXCustomizer or other similar feature.

If you need to customize the styles of an existing hyperlink on-the-fly, you need to use customizeWordContent available in Premium licenses.