PDF and CSV generation are not working

0

Installed version Stock Manager Advance with POS Module v3.4.31. The live version is v3.4.29 hence can't test.
using
PHP 7.3.16 (cli) (built: Mar 17 2020 10:18:38) ( NTS ) with all the recommended extensions installed.

The code breaks each time I tried to generate a pdf or CSV file

Question Resolved For: Stock Manager Advance with Point of Sale Module 0 Votes 17 Answers 3.5k Views
Asked by Benjamin Eshun 5 years ago

0

Answered by Mian Saleem 5 years ago

Hello,

The demo has been updated. You can test. If demo is fine, you can check your server error logs and let me know the error details so that I can suggest.

Thank you

0

Answered by Benjamin Eshun 5 years ago

Hi,

The demo seems fine. However nothing comes up in the error logs. Could it be a permissions issue? What are all the folders that need a write permission for the pdf and csv exports for work.

Grateful for the assistance.

0

Answered by NGUYEn hONG PHONG 5 years ago

error

0

Answered by Mian Saleem 5 years ago

Blank page is mostly caused by 500 internal server error. The error should be logged, you can check the error log again.

You can enable app logs by changing the log_threshold to 1 in app/config/config.php and then visit page again to reproduce error. Lastly check the latest log in app/logs/ folder.

Thank you

0

Answered by Benjamin Eshun 5 years ago

thanks I'm getting
Temporary files directory "/var/www/zzzz/data/www/xxxxxxx/vendor/mpdf/mpdf/src/Config/../../tmp" is not writable

from ....vendor/mpdf/mpdf/src/Cache.php 17

From the code line 17 is

throw new \Mpdf\MpdfException(sprintf('Temporary files directory "%s" is not writable', $basePath));

How do I set the real path is $basePath

0

Answered by Mian Saleem 5 years ago

Hello,

You are not suggested to change the code. Instead you should change the ownership of the files and folder to www-data or check with your server admin/host for help.

Thank you

0

Answered by Benjamin Eshun 5 years ago

Hi ,

Not the code, the path is vendor/mpdf/mpdf/src/Config/../../tmp and the "/../../" should not be in the $basePath variable. How do I remove it from the variable

Thanks

0

Answered by Mian Saleem 5 years ago

Hello,

If you want to set custom path then you can edit app/libraries/Tec_mpdf.php and replace

$mpdf = new Mpdf();

with

$mpdf = new Mpdf(['tempDir' => __DIR__ . '/custom/temp/dir/path']);

0

Answered by Benjamin Eshun 5 years ago

Hello,

Your suggestion is noted and will implement.

On a related issue, we I use the dompdf PDF Library I get the following error...

ERROR - 2020-04-05 10:45:55 --> Severity: error --> Exception: Class 'DOMDocument' not found /var/www/user/data/www/domain.tld/vendor/dompdf/dompdf/lib/html5lib/TreeBuilder.php 155

I also get the following errors when I try to generate a CSV file

ERROR - 2020-04-05 11:11:33 --> Severity: error --> Exception: Class 'XMLWriter' not found /var/www/user/data/www/domain.tld/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/XMLWriter.php 5

in both cases "user'" and "domain.tld" are just placeholders of the actual.

Thanks

0

Answered by Mian Saleem 5 years ago

Hello,

Please enable/install php-xml extension then test both. If still having the dompdf error then you might need tenable/install php-dom too.

Thank you

We use Cookies

We use cookies to ensure that we give you the best experience on our website. By continuing to browse the site you are agreeing to our use of cookies.