I want to use this library: http://www.princexml.com/ That helps me create PDF files from an HTML/XML files.
I downloaded the PHP zip file from here: http://www.princexml.com/download/wrappers/ and added it to my "libraries" folder in the codeigniter directory. from what I know, I just have to include/call the library and use it's functions regularly. https://ellislab.com/codeigniter/user-guide/general/creating_libraries.html
I am using WAMP (Windows) so I created an Alias to
C:\Program Files (x86)\Prince\engine\bin
where the prince.exe is found, and called it "prince" (http://localhost/prince
).
had this on my controller:
public function banana(){
$this->load->library('prince');
$prince = new Prince('http://localhost/prince/prince.exe');
$xmlPath = 'http://localhost/temp/test.html';
$this->prince->convert_file_to_passthru($xmlPath);
}
And I got these errors:
A PHP Error was encountered
Severity: Warning
Message: Missing argument 1 for Prince::__construct(), called in C:\wamp\www\tools\system\core\Loader.php on line 1247 and defined
Filename: libraries/prince.php
Line Number: 48
Backtrace:
File: C:\wamp\www\tools\application\libraries\prince.php Line: 48 Function: _error_handler
File: C:\wamp\www\tools\application\controllers\aso\Cli_kas.php Line: 304 Function: library
File: C:\wamp\www\tools\index.php Line: 292 Function: require_once
A PHP Error was encountered
Severity: Notice
Message: Undefined variable: exePath
Filename: libraries/prince.php
Line Number: 50
Backtrace:
File: C:\wamp\www\tools\application\libraries\prince.php Line: 50 Function: _error_handler
File: C:\wamp\www\tools\application\controllers\aso\Cli_kas.php Line: 304 Function: library
File: C:\wamp\www\tools\index.php Line: 292 Function: require_once
A PHP Error was encountered
Severity: Warning
Message: proc_open(): CreateProcess failed, error code - 87
Filename: libraries/prince.php
Line Number: 796
Backtrace:
File: C:\wamp\www\tools\application\libraries\prince.php Line: 796 Function: proc_open
File: C:\wamp\www\tools\application\libraries\prince.php Line: 528 Function: convert_internal_file_to_passthru
File: C:\wamp\www\tools\application\controllers\aso\Cli_kas.php Line: 311 Function: convert_file_to_passthru
File: C:\wamp\www\tools\index.php Line: 292 Function: require_once
An uncaught Exception was encountered
Type: Exception
Message: Failed to execute "" --structured-log=buffered "http://localhost/temp/test.html" -o -
Filename: C:\wamp\www\tools\application\libraries\prince.php
Line Number: 814
Backtrace:
File: C:\wamp\www\tools\application\libraries\prince.php Line: 528 Function: convert_internal_file_to_passthru
File: C:\wamp\www\tools\application\controllers\aso\Cli_kas.php Line: 311 Function: convert_file_to_passthru
File: C:\wamp\www\tools\index.php Line: 292 Function: require_once
This is my first time running an external library from CodeIgniter, I am not sure what to do and codeigniter docs don't mention too much information.
Creating the ALIAS didn't work, so I think this is why it's not recognizing the variable of the exePath
.
How do I all the "Prince" library and get it working on CodeIgniter?