Forum


Replies: 4   Views: 336
Simultaneous pdf creation?
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 meyerandassoc  · 02-05-2024 - 13:53

Hi,

We had two of our users submit a request for a PDF document to be created a few seconds apart. This was not intentional; just a timing issue. The result was that the first requested PDF was created, but the second requested PDF was not created.

The only errors in the logs were associated to the PDF file not being found.

FAIL::2::185::.\phpdocx\classes\TransformDocAdvLibreOffice.php::rename(.\temp\Account 987654321 Update - 1714522260.pdf,.\temp\Account 987654321 Update - 1714522260.pdf): The system cannot find the file specified (code: 2)

Is this a known issue/limitation, or did we just run into an annomoly?

The order things transpired is:

  • 1st requested Word document was completed.
  • Call to the 1st requested PDF started.
  • 2nd requeted Word document was completed.
  • Call to the 2nd requested PDF started.
  • 1st requested PDF was completed. (this took about 8 seconds)
  • 2nd requested PDF was never created.  

 

We are running PhpDocx 14.5 Advanced on Windows/IIS/PHP 8, and using LibreOffice as the executable to create the PDFs.

Our process uses a Word template. Our code creates a Word document using the Word tempalte, then creates a PDF using the Word document.

$docx->createDocx($WordFileName);
$docx->transformDocument($WordFileName, $PDFFileName);

 

 

Posted by admin  · 02-05-2024 - 16:02

Hello,

To do concurrent conversions with the conversion plugin based on LibreOffice, you need to use a user profile for each conversion.

Please check the information available on https://www.phpdocx.com/documentation/conversion-plugin/common-problems-and-possible-errors (Concurrent conversions section). Although the information is detailed for Linux servers, the same can be used with Windows and macOS servers. We recommend you use the extraOptions option in your Windows server.

Regards.

Posted by meyerandassoc  · 02-05-2024 - 18:08

Thank you very much for your reply. 

I will test the random path recommendation.

 

Posted by meyerandassoc  · 02-05-2024 - 20:02

An update on solving the Concurrent Conversion issue.

The 'homeFolder' example made absolutly no difference.

After trying a variety of ideas, I was finally able to get the 'UserInstallation' exaple to work. This required removing the existing 'UserInstallation' definition in the phpdocxconfig.ini file.

The 'UserInstallation' definition supplied via code does not overwrite the 'UserInstallation' definition in the phpdocxconfig.ini file even though the 'UserInstallation' definition supplied in the code appears in the command passed to the .exe (it appears after the definition from the phpdocxconfig.ini file).

Posted by admin  · 02-05-2024 - 20:39

Hello,

The extraOptions option adds extra parameters to the soffice command. If the UserInstallation was being added in the phpdocxconfig.ini file, extraOptions is added at the end of the command, so only the first UserInstallation parameter is readed by LibreOffice. In this case, the best approach is removing UserInstallation from the phpdocxconfig.ini and add a custom one using PHP.

Regards.