rae_rae
asked on
PDFLib throws exception...why?
I have this code which is supposed to create a pdf. but it throws an exception instead:
PDFlibException: Function must not be called in 'object' scope in C:\xampp\htdocs\xampp\sys\ pages\pdfi nvoice.php on line 306
Call Stack
# Time Memory Function Location
1 0.0016 147200 {main}( ) ..\pdfinvoice.php:0
2 0.0046 376032 pdfInvoice->__construct( ) ..\pdfinvoice.php:315
3 0.0826 5794384 pdfInvoice->buildReport( ) ..\pdfinvoice.php:44
4 0.1044 5914496 pdfInvoice->createPdf( ) ..\pdfinvoice.php:289
5 0.1047 5972672 PDFlib->begin_page_ext( ) ..\pdfinvoice.php:306
My setup:
In Windows XP Pro....
Downloaded Windows PDFlib-7.0.4p2-MSWin32-php
Copied PDFlib-7.0.4p2-MSWin32-php \bind\php5 \php-520\l ibpdf_php. dll to C:\xampp\php\ext
In C:\xampp\apache\bin\php.in i:
Commented out ;extension=php_pdf.dll
Added in extension=libpdf_php.dll
Everyone seems to have a different opinion about the fix for this...I have already tried every solution posted on google in the first page, including using the default extension in php.ini which just creates a white screen...which is a sure sign of a memory problem and I'm certain this is not the issue...
PDFlibException: Function must not be called in 'object' scope in C:\xampp\htdocs\xampp\sys\
Call Stack
# Time Memory Function Location
1 0.0016 147200 {main}( ) ..\pdfinvoice.php:0
2 0.0046 376032 pdfInvoice->__construct( ) ..\pdfinvoice.php:315
3 0.0826 5794384 pdfInvoice->buildReport( ) ..\pdfinvoice.php:44
4 0.1044 5914496 pdfInvoice->createPdf( ) ..\pdfinvoice.php:289
5 0.1047 5972672 PDFlib->begin_page_ext( ) ..\pdfinvoice.php:306
My setup:
In Windows XP Pro....
Downloaded Windows PDFlib-7.0.4p2-MSWin32-php
Copied PDFlib-7.0.4p2-MSWin32-php
In C:\xampp\apache\bin\php.in
Commented out ;extension=php_pdf.dll
Added in extension=libpdf_php.dll
Everyone seems to have a different opinion about the fix for this...I have already tried every solution posted on google in the first page, including using the default extension in php.ini which just creates a white screen...which is a sure sign of a memory problem and I'm certain this is not the issue...
private function createPdf($sponsor_code, $report)
{
// Initialize the pdf
$pdf = new PDFlib();
$pdf->set_parameter('errorpolicy', 'return');
$pdf->set_parameter('SearchPath', $this->getConfig('base_dir') . $this->getConfig('page_dir'));
$pdf->set_info('Author', 'RevShare');
$pdf->set_info('Title', 'RevShare Invoice');
// Start new page: width, height
$pdf->begin_page_ext(595, 842, 'topdown');
// Name the output file
$pdf->begin_document("{$sponsor_code}.pdf", "");
$this->dump($pdf);exit;
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER