Hello,
We never remove the Sub Main method, but it should work without it. Anyway, please restore it.
Maybe you haven't added the macro to the correct Module1? Please note that the macro should be added to the Module1.xba file of the user that is running LibreOffice; each user may have its own .config folder and Module1.xba file.
As we can't connect to your server, please do the following tests, using the command line, please run libreoffice directly:
/opt/libreoffice6.4/program/soffice --invisible "macro:///Standard.Module1.LosslessPdf(/var/www/document/output.docx)"
Changing /opt/libreoffice6.4/program/soffice by the path where LibreOffice is installed. And /var/www/document/output.docx by the absolute path of the DOCX to be transformed. Please run this command in the folder of the DOCX to be transformed. Please note that LosslessPdf is the name of the added macro, do not use LosslessCompressionPdf in Module1.xba but LosslessPdf.
If the previous test works, then please create a simple script to run the code from PHP:
<?php
passthru('/opt/libreoffice6.4/program/soffice --invisible "macro:///Standard.Module1.LosslessPdf(/var/www/document/output.docx)"');
We are doing many tests and in all cases, it is working correctly. The previous command is used by phpdocx to transform the DOCX to PDF using LosslessPdf.
Regards.