Import mpdf classes

i’ve created a gad-7 form using the forms api, and would like to generate a pdf of a completed form, using the mpdf classes and functions. I cannot see what i need to successfully import them using “use Mpdf\Mpdf”

at the moment i get an error:

PHP Fatal error: Uncaught Error: Class ‘Mpdf\Mpdf’ not found in /var/www/test.homelesshealthlink.com/public_html/interface/forms/gad-7/first_mpdf.php

where first_mpdf.php is a file i’m trying out the mpdf functionality in. The only other thing i’ve included at this stage is globals.inc

the mpdf files are in …/…/…/vendor/mpdf/mpdf

many thanks for any help

hi everyone,
i solved the problem. in the cooler light of day i was confusing my own folders!

the answer is that all that was needed was to include globals.inc, hence the start of the file (in interface/forms/gad7 ) is now

<?PHP require_once "../../globals.php"; use Mpdf\Mpdf; ... followed by the usual use of Mpdf, generating a pdf file. hooray.
1 Like

thanks for following up @ruth, would you be interested in sharing the form with the community?

hi stephen,

yes indeed, we were planning to do that - thanks for asking.
i’m hoping it will get tested by real users, and i’m also adding a bit of functionality - then will most definitely share it.

1 Like