# x2t-testing **Repository Path**: only-office/x2t-testing ## Basic Information - **Project Name**: x2t-testing - **Description**: x2t-testing - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-05-25 - **Last Updated**: 2024-05-25 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Testing x2t ***The x2t-testing project is deprecated*** Please refer to [x2ttester_wrapper](https://github.com/ONLYOFFICE-QA/x2ttester_wrapper) Is project for testing main conversion lib in onlyoffice documentserver ## How it work X2t utility need 12 libs for work. They are placed in documentserver `/var/www/onlyoffice/documentserver/server/FileConverter/bin/`. Easy way to take it - use docker-compose from this project. After it, you need to place all lib's to `/usr/lib` in your server, and then start work with x2t. Example for x2t work: `x2t file_for_convert.docx resulting_file.ods folder_with_fonts` `file_for_convert.docx` - filename (or filepath) for file for convertion. Right extname is important `resulting_file.ods` - filename (or filepath) for resulting file. Right extname is important `folder_with_fonts` - path to folder with fonts. Optional parameter. Example for x2t work with xml parameter: You can use xml file with parameters instead of parameners in command line. For it, create file like this: ```xml conv_Khirz6zTPdar34_pdf /share/CreateImage.docx /share/CreateImage.pdf 513 46 4 false 2020-09-30T11:14:00.207Z true ``` `m_sFileFrom` - filename (or filepath) for file for convertion. Right extname is important `m_sFileTo` - filename (or filepath) for resulting file. Right extname is important `m_nFormatTo` - digital code for formal (513 - [pdf](https://github.com/ONLYOFFICE/core/blob/master/Common/OfficeFileFormats.h#L86)) X2t need more libs for convertion to pdf. All necessary libs in described in `DoctRenderer.config`, but you can use x2t inside of documentserver for easy setup To convert via xml use a numeric code in **HEX** format. A list of all the codes for the formats is described in the file. [OfficeFileFormats.h](https://github.com/ONLYOFFICE/core/blob/master/Common/OfficeFileFormats.h) ## Getting Started ### Running tests Change **dockerfile** and **docker-compose** file. 1. Change image in .env. 2. Set 3 environment variables in dockerfile: **S3_KEY** - is a public s3 key for getting files **S3_PRIVATE_KEY** - is a private s3 key for getting files **PALLADIUM_TOKEN** - is a palladium token for writing results. Then, run documentserver docker-compose for getting all libs ``docker-compose up documentserver`` And then, you can run tests ``docker-compose up -d x2t-testing`` ## Convert Utility Libs in this project can be used separately of tests like utility for conversion. ### For Start 1. Change image in ``.env.`` 2. Run documentserver docker-compose for getting all libs with the command: ``docker-compose up documentserver`` 3. Change ``configure.json`` 4. Run conversion File **configure.json** contain all settings for it. Example: ```bash { "convert_from": "/tmp/folders_with_files/", "custom_folder": "/tmp/path_to_source_files/", "convert_to": "/tmp/results/", "custom_format": "docx", "conversion_formats": { "doc": "docx", "ppt": "pptx", "xls": "xlsx", "odp": "pptx", "rtf": "docx" }, "x2t_path": "tmp/x2t", "font_path": "tmp/fonts" } ``` **convert_from** - path to folders with documents before conversion, the folder names must match the file extension(if the file extension in the folder is ".doc", then the folder name must be "doc"), used to convert from an array of extensions with the **rake convert[arr]** command **custom_folder** - the path to a separate folder with the source files to convert using the **rake convert[cstm]** command **custom_format** - files from **custom_folder** will be converted to this format, to convert using the **rake convert[cstm]** command **convert_to** - is a folder for results. **conversion_formats** - an array of extensions to convert **x2t_path** - path to x2t file. **font_path**- path to fonts folder ## Сonversion commands ``rake convert[arr]``- Conversion from an array of extensions specified in**configure.json/conversion_formats**. ``rake convert[cstm]`` - Conversion from a separate folder with files. ## Checking ooxmlparser To enable the ooxmlparser check, pass ``true`` as the second argument to the command. Example: ``rake convert[arr,true]`` ## Troubleshooting * Error `Couldn't create temp folder` You need to execute x2t with `sudo`, or add more accesses to x2t * Infinity conversion There in timeout for conversion in documentserver - 5 minutes. If conversion of some files os hold more time - document will not be saved. It is bad, but sometimes it happens. Need to create bug if this behavior is a new for current file. * Errors in console during conversion It is not bad, see resulting file * Resulting file is not created/file with zero size You need to create new bug for Elena Subbotina. Example of bug - 39541