If my word document contains a text with a hyperlink then a word to pdf using phpdocx change font color to blue and underline on text. How can I remove those default behavior and keep the exact style that exists in my word(LibreOffice) document?
If my word document contains a text with a hyperlink then a word to pdf using phpdocx change font color to blue and underline on text. How can I remove those default behavior and keep the exact style that exists in my word(LibreOffice) document?
Hello,
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'=> 'http://www.google.com',
'color' => 'B70000',
'underline' => 'none',
'strikeThrough' => false,
);
$docx->addLink('Link to Google in red color and not underlined', $linkOptions);
$docx->createDocx('document');
$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="www.google.com" 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.
Regards.