Drupal 7: Print pdf using dompdf

I need help installing dompdf. Where should I put the extracted zip file into a directory? I followed INSTALL.txt and it says: "Extract the contents of the downloaded package into one of the supported paths." Does this mean placement in the Modules folder? if so, an error occurs requesting for ".info". And it is not supplied. Please help, I'm confused! Thanks!

+4
source share
2 answers

Supported paths are listed in the install.txt file:

supported paths: * print module lib directory (usually sites/all/modules/print/lib) * libraries directory (sites/all/libraries) 

I prefer the second option, this will not allow you to do this every time you update the module.

In other words, it should look like this: sites/all/libraries/dompdf

+1
source

this is how i downloaded it

  • I moved the dompdf-0.5.1 folder to the /sites/all/libraries folder
  • I edited dompdf_config.inc.php, replacing the DOMPDF_autoload() function with:

code:

 function DOMPDF_autoload($class) { /* Add this checking - START */ if (mb_strtolower($class)== 'firephp'){ return; } /* Add this checking - END */ $filename = mb_strtolower($class) . ".cls.php"; require_once(DOMPDF_INC_DIR . "/$filename"); } if ( !function_exists("__autoload") ) { /** * Default __autoload() function * * @param string $class */ function __autoload($class) { DOMPDF_autoload($class); } } 
  • now you can use it the same way in any other module

code:

  require_once(realpath('.')."/sites/all/libraries/dompdf-0.5.1/dompdf_config.inc.php"); spl_autoload_register('DOMPDF_autoload'); $obj = new DOMPDF(); 

This worked, and I was able to use the DOMPDF object / class.

+1
source

Source: https://habr.com/ru/post/1447124/


All Articles