Closed jonua closed 9 years ago
it probably means your web server does not have write access to ttfontdata/ folder or that dejavusanscondensed.GSUBGPOStables.dat already exists but could not be written by the web server. Did you manage to fix the issue on your side?
A have same problem in Symfony2. mpdf located in vendor, it's ok try write to vendor directory?
You may want to check permissions and also look out for help on mpdf forums.
For example see if this solution helps
Solve this problem by: define('_MPDF_TTFONTDATAPATH',$temp_dir); before creating instance of mPDF. $temp_dir is dir out of vendor. All work fine now.
Thanks for the feedback. I may provide a configuration option for this in the component as well.
Will be resolved via #12.
Closing this.
file_put_contents(/var/www/cluewiz/vendor/mpdf/mpdf/ttfontdata/dejavusanscondensed.GSUBGPOStables.dat): failed to open stream: No such file or directory
Getting this error
I started getting the same error, and I think I finally figured out. After kartik-v changed $pdfLibraryPath property from '@vendor/kartik-v/mpdf' to '@vendor/mpdf/mpdf' (https://github.com/kartik-v/yii2-export/commit/8b60570fb3f541c2fac8ea4ea8e221d6a28e8750#diff-76ff5c7d38933d45f929b811c29f3b62R444) constant _MPDF_TTFONTDATAPATH now gets value from mpdf/mpdf again and tries to write to the vendor (before that commit _MPDF_TTFONTDATAPATH overrides to Yii::getAlias('@runtime/mpdf') during kartik-v/mpdf initialization)
Ran into this same issue. Did the following before instancing mPDF and it worked.
define('_MPDF_TTFONTDATAPATH',Yii::getAlias('@runtime/mpdf'));
@asmythe this is already taken care of in the Pdf component in this place ... not sure you would need to do that...
Hi, kartik-v, check please my comment above. I could be wrong, but kartik-v/mpdf component did not initializing at all since your commit (https://github.com/kartik-v/yii2-export/commit/8b60570fb3f541c2fac8ea4ea8e221d6a28e8750#diff-76ff5c7d38933d45f929b811c29f3b62R444)
@anton-github the component does initialize fine as seen on the demos page and it should use the logic I mentioned above to create the mpdf
directory in your app's runtime
folder.
The commit you mentioned above has only one significant change in the repo change for mpdf source library, and you need to ensure that the new extension with its dependencies (including the mpdf repo) are installed fine... and you do not have two different mpdf libraries.
file_put_contents(E:/websites/test/vendor/mpdf/mpdf/ttfontdata/dejavusanscondensed.GSUBGPOStables.dat): failed to open stream: Permission denied
Added $temp_dir = DIR.'\mpdf\mpdf\ttfonts'; define('_MPDF_TTFONTDATAPATH',$temp_dir); before $pdf = new mPDF('utf-8', 'A4');
Can anyone help me?
I faces same problem :( I resolved to create tamp folder with permission 777 and its working :)....
This happens because mPDF trying to write a temporary file on TTFONTDATA folder
You can solve it by giving TTFONTDATA folder write permission 0777 or by Changing the _MPDF_TTFONTDATAPATH path to the Linux temp directory by adding the following line before creating the instance of mPDF
define('_MPDF_TTFONTDATAPATH', sys_get_temp_dir()."/");
If you wish to set your own temporary location set the Pdf::tempPath
property to a valid temporary directory and the above should be automatically taken care of.
I'm using mPDF inmy action like this:
and I receive the exception:
How can I solve this trouble?