Forum


Replies: 5   Views: 200
How to add watermark on .doc file
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 ealnour  · 10-08-2024 - 09:39

Hello Team,
I want to add watermark on. .doc file, it's working with docx but i want to add with doc file , Can you help me because my client purchased this for only watermark but we have lots of .doc files

Also , Is it possible to remove the watermark from a pdf?

Thanks 

Posted by admin  · 10-08-2024 - 15:55

Hello,

watermarkDocx (https://www.phpdocx.com/api-documentation/docxutilities/insert-watermark-Word-document-with-PHP) works only with DOCX documents.

There's no method in phpdocx to add a watermark to a DOC file. In this case, the best approach is transforming DOC to DOCX and then use watermarkDocx to add watermarks. You can transform DOC to DOCX using the conversion plugin (https://www.phpdocx.com/documentation/conversion-plugin/information).

watermarkRemove (https://www.phpdocx.com/api-documentation/docxutilities/removes-watermark-Word-document-with-PHP) can remove watermarks from DOCX documents, but there's no method available in phpdocx to remove watermarks from PDF files.

Regards.

Posted by ealnour  · 12-08-2024 - 03:55

Hello Team,

I have premium library and tried to find an example for convert doc to docx but I have not found any example , Can you please help me give example?


Thanks

Posted by admin  · 12-08-2024 - 05:50

Hello,

You need to use the conversion plugin based on LibreOffice or MS Word to convert from DOC to DOCX.

On https://www.phpdocx.com/documentation/conversion-plugin you can read all information about the conversion plugin and samples. In the package (examples/FormatConversion/transformDocument folder) you can find samples using it.

For example, if you have installed the conversion plugin based on LibreOffice, you can transform a DOCX to PDF:

$docx->transformDocument('document.docx', 'document.pdf', 'libreoffice');

or a DOC to DOCX:

$docx->transformDocument('document.doc', 'document.docx', 'libreoffice');

or a DOCX to DOC:

$docx->transformDocument('document.docx', 'document.doc', 'libreoffice');

And all other supported document types.

Regards.

Posted by ealnour  · 12-08-2024 - 17:23

Warning: Undefined array key "path" in C:\xampp\htdocs\sbg\wp-content\themes\twentytwentytwo\PHPDoc_premium\classes\TransformDocAdvLibreOffice.php on line 108

Warning: rename(./transformDocument_libreoffice_1.pdf,transformDocument_libreoffice_1.pdf): The system cannot find the file specified (code: 2) in C:\xampp\htdocs\sbg\wp-content\themes\twentytwentytwo\PHPDoc_premium\classes\TransformDocAdvLibreOffice.php on line 199

Facing this error

Posted by admin  · 12-08-2024 - 17:54

Hello,

You need to configure the conversion plugin to use it.

If you get an "Undefined array key path" error is because you are using the conversion plugin based on LibreOffice and you have not set the path to LibreOffice in the config/phpdocxconfig.ini file. On https://www.phpdocx.com/documentation/conversion-plugin/conversion-plugin-installation-and-set-up you can read how to configure it.

On https://www.phpdocx.com/documentation/conversion-plugin you can read all the information about how to configure, debug, and use the conversion plugin. In the package, you can also find samples using all conversion plugins (examples/FormatConversion/transformDocument folder).

Regards.