First of all thank you for your module. It looks very promising for resolving an issue I have with a current project.

Unfortunately I can't get it working. For now only blank PDF output is created.
None of the fields in the views is printed to PDF.

Maybe something is wrong with my installation although 'Status report' says it's ok:

Views PDF - FPDI Present
Views PDF - FPDI Template File Present
Views PDF - TCPDF Present

Used versions located in ..sites/all/libraries/
FPDI 1.4.2
TCPDF 5.9.120

I tested with views_pdf 7.x-1.0-rc1 and with 7.x-1.x-dev.
Same result for both.

When I create a new views display of type "PDF page" I get the following strict warnings:

Strict warning: Declaration of FPDF::_putstream() should be compatible with that of TCPDF::_putstream() in require_once() (line 17 of ../sites/all/modules/contrib/views_pdf/views_pdf_template.php).
Strict warning: Declaration of FPDF_TPL::AddPage() should be compatible with that of TCPDF::AddPage() in require_once() (line 27 of ../sites/all/libraries/fpdi/fpdi.php).
Strict warning: Declaration of FPDF_TPL::SetFont() should be compatible with that of TCPDF::SetFont() in require_once() (line 27 of ../sites/all/libraries/fpdi/fpdi.php).
Strict warning: Declaration of FPDF_TPL::Link() should be compatible with that of TCPDF::Link() in require_once() (line 27 of ../sites/all/libraries/fpdi/fpdi.php).
Strict warning: Declaration of FPDF_TPL::Image() should be compatible with that of TCPDF::Image() in require_once() (line 27 of ../sites/all/libraries/fpdi/fpdi.php).

Any help is very appreciated.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jbiechele’s picture

Maybe anybody with a working environment could shortly write down the
used versions of views_pdf 7.x-1.0-..., FPDF and TCPDF please? Thank you

jbiechele’s picture

I get the same error with a vanilla Drupal 7 installation.
My machine environment is a Mac with XAMPP and PHP 5.2.x.

Any ideas please what's going wrong here?

jbiechele’s picture

I completely reinstalled views_pdf 7.x-1.x-dev, TCPDF 5.9.136, FPDI 1.4.2 and FPDF_TPL 1.2 but no luck.
I'm getting the same error again.

Please could anybody make a note here which versions you use for FPDI on a running installation.
Thanks in advance for any hint.

jbiechele’s picture

Version: 7.x-1.0-rc1 » 7.x-1.x-dev
sorensong’s picture

+1

cardentey’s picture

He modificado los archivos de fpdi y tcpdf para que las declaraciones de funciones sean compatibles, a cualquier interesado por favor lo puede descargar de este enlace.

google translator: I modified files FPDI and TCPDF for function declarations are compatible, anyone interested please download it from this link.

http://www.fileserve.com/file/TY5fdHh/libraries.rar

hregis’s picture

This is because your php using strict mode (E_STRICT) tcpdf and is not coded correctly for this mode. If you are using php 5.3 you can disable E_STRICT in php.ini. if it's php 5.4 it will be more complicated because this mode has become the "mode of production" of PHP.

jbiechele’s picture

@6 Unfortunately fileserve.com doesn't work anymore.
Any chance to get your adjustments from another place?

@7 Thank you very much for clarifiying this one. I'm on PHP 5.3.1 now.
As soon as I've time I will try it and report back the results.

frankiedesign’s picture

Ok, some people continue to talk about 'errors'.. there is no error!
There are WARNINGS!

And the warning description already says it all. You just have to alter the declarations of the mentioned functions in one file to fit the other. 'Fit' in that case means, that the arguments should be the same. (Optional arguments, in doubt.)

If you say, "Damn I already did this, but it does not change anything!", most probably you have changed the wrong file:
Check your php include paths for the libraries! The 'require_once' calls might fetch the file from there, and not from your drupal/.../sites/all/libraries... directory, or wherever the file you changed resides. So in case alter the require_once part as well. The 'addPage/AddPage' functions from the library and the modules template are entirely different, but a warning is thrown if the number of arguments are not equal. So hack some dummy into it. Yes, it's a dirty fix, due to duplicate function names, but it's no magic.

seblecz’s picture

Same problem.
I have exactly the same warnings.
I'm on php 5.4 and can't change my php.ini.
Is anyone could anything for me?
@cardentey : Could you explain your modification for function declarations are compatible?

cardentey’s picture

bendev’s picture

thanks I managed to solve the other warnings. I am left with this one :
Strict warning: Declaration of PdfTemplate::addPage() should be compatible with TCPDF::AddPage($orientation = '', $format = '', $keepmargins = false, $tocpage = false) in require_once() (line 25 of /Applications/MAMP/htdocs/XXX/sites/all/modules/views_pdf/views_pdf_template.php).

Could you please advise how to align both functions declarations ?
thanks

juankvillegas’s picture

bendev, did you find how to fix the issue with that last warning?

bendev’s picture

Not yet, if I find it out I'll post it here

luuuukke’s picture

subscribing

patman1706’s picture

Version: 7.x-1.x-dev » 7.x-1.0-rc1

just installed views PDF module.
same problem as jbiechele (Strict warning: Declaration of FPDF::_putstream() should be compatible with that of TCPDF...).

maybe that some documentation on what to check or a step by step procedure on the tcpdf library installation would help people ?

i had a lots of expectation on that module (example: print a table view with the lines of the tables).
module print has this problem and i wanted to try views pdf but the way to get at it seems long :-)
any help would be greatly appreciated...

tstaylor7’s picture

Title: Strict warning: Declaration of FPDF::_putstream() should be compatible with that of TCPDF::_putstream() » Declaration of FPDF::_putstream() should be compatible with that of TCPDF::_putstream()
FileSize
2.22 KB

Here is a patch to make FPDI 1.4.3 and FPDF TPL 1.2.1 compatible with TCDPF 5.9.205. I'm sure it will work with various other versions, as well. This is a -p1 patch to be applied on your FDPI and FPDF TPL directory.

hectorelgomez’s picture

Thanks, it works perfectly.

Muchas gracias, funciona a la perfección.

Simon Georges’s picture

Version: 7.x-1.0-rc1 » 7.x-1.x-dev
Status: Active » Needs review
gettysburger’s picture

I applied patch #17 and it got rid of every error except:

Strict warning: Declaration of PdfTemplate::addPage() should be compatible with TCPDF::AddPage($orientation = '', $format = '', $keepmargins = false, $tocpage = false) in require_once() (line 24 of /Applications/MAMP/htdocs/mysite/sites/all/modules/views_pdf/views_pdf_template.php).

Any thoughts? Thanks.

7.x-1.x-dev, TCPDF 5.9.207, FPDI 1.4.3 and FPDF_TPL 1.2.1

I ran this in my fpdi folder. Am I also supposed to run it in my tcpdf folder?

gettysburger’s picture

Has anyone found a combination of the fpdi and tcpdf libraries that play well together? I really need to use this module and a lot of people seem to have it working, but I keep getting the Declaration of PdfTemplate::addPage() error message which tells me they are conflicting. Thanks.

juankvillegas’s picture

This combination is working for me. Use it at your own risk. http://www.papayamedia.com/sites/papayamedia.com/files/fpdi-tcpdf.zip

azcn2503’s picture

Good morning.

I found a solution to this problem today. I am running Ubuntu Server 12.04LTS with Nginx and PHP5-FPM. I am using the files provided by PDFMerger (http://pdfmerger.codeplex.com/) which appears to be quite out of date.

My first task was to replace the '=&' assign by reference operator with simply '=', to remove the message about this deprecated feature. I had to change the files PDFMerger/fpdi/fpdi_pdf_parser.php and PDFMerger/fpdi/fpdi.php.

For the message:
[error] 962#0: *1542 FastCGI sent in stderr: "PHP message: PHP Strict Standards: Declaration of FPDF_TPL::Image() should be compatible with that of FPDF::Image() in ...

I looked through the PDFMerger/fpdi/fpdf_tpl.php and PDFMerger/fpdf/fpdf.php files to make sure that the line starting with function Image( was the same in both.

In my fpdf.php file, I changed this line to:
function Image($file, $x=null, $y=null, $w=0, $h=0, $type='', $link='', $align='', $resize=false, $dpi=300, $palign='', $ismask=false, $imgmask=false, $border=0)

In my fpdf_tpl.php file, I changed this line to:
function Image($file, $x=null, $y=null, $w=0, $h=0, $type='', $link='', $align='', $resize=false, $dpi=300, $palign='', $ismask=false, $imgmask=false, $border=0) {

The error is due to a mismatch of the number of arguments supplied to the method. When the fpdf_tpl.php file extends the FPDF class in to the new FPDF_TPL class, you will see that the number of arguments are different, or have different default values. For more information, see this Stack Overflow article: http://stackoverflow.com/questions/3115388/declaration-of-methods-should...

I hope this helps someone. Good luck!

Update: Although I fixed the warnings and errors, I eventually decided that I would delegate my PDF merging functionality to the gs application using shell_exec. It may not be glamorous, but it works a lot easier, and quicker.

Simon Georges’s picture

pmol123’s picture

I made the above change. Upon saving a PDF view I get the following:

Strict warning: Declaration of PdfTemplate::addPage() should be compatible with TCPDF::AddPage($orientation = '', $format = '', $keepmargins = false, $tocpage = false) in require_once() (line 24 of /var/www/drupal/sites/all/modules/views_pdf/views_pdf_template.php). Backtrace:
require_once('/var/www/drupal/sites/all/modules/views_pdf/views_pdf_template.php') views_pdf.module:167
_views_pdf_include_pdf_lib() views_pdf.module:65
views_pdf_get_font_list() views_pdf_plugin_display.inc:390
views_pdf_plugin_display->options_summary(Array, Array) admin.inc:1706
views_ui_get_display_tab_details(Object, Object) admin.inc:1537
views_ui_get_display_tab(Object, 'p_display_invoice_pdf') admin.inc:1133
views_ui_edit_form(Array, Array, Object, 'p_display_invoice_pdf') 
call_user_func_array('views_ui_edit_form', Array) form.inc:798
drupal_retrieve_form('views_ui_edit_form', Array) form.inc:339
drupal_build_form('views_ui_edit_form', Array) form.inc:131
drupal_get_form('views_ui_edit_form', Object, 'p_display_invoice_pdf') admin.inc:923
views_ui_edit_page(Object, 'p_display_invoice_pdf') 
call_user_func_array('views_ui_edit_page', Array) menu.inc:517
menu_execute_active_handler() index.php:27
Strict warning: Declaration of PdfTemplate::addPage() should be compatible with TCPDF::AddPage($orientation = '', $format = '', $keepmargins = false, $tocpage = false) in require_once() (line 24 of /var/www/drupal/sites/all/modules/views_pdf/views_pdf_template.php). Backtrace:
require_once('/var/www/drupal/sites/all/modules/views_pdf/views_pdf_template.php') views_pdf.module:167
_views_pdf_include_pdf_lib() views_pdf.module:65
views_pdf_get_font_list() views_pdf_plugin_display.inc:390
views_pdf_plugin_display->options_summary(Array, Array) admin.inc:1706
views_ui_get_display_tab_details(Object, Object) admin.inc:1537
views_ui_get_display_tab(Object, 'p_display_invoice_pdf') admin.inc:1133
views_ui_edit_form(Array, Array, Object, 'p_display_invoice_pdf') 
call_user_func_array('views_ui_edit_form', Array) form.inc:798
drupal_retrieve_form('views_ui_edit_form', Array) form.inc:339
drupal_build_form('views_ui_edit_form', Array) form.inc:131
drupal_get_form('views_ui_edit_form', Object, 'p_display_invoice_pdf') admin.inc:923
views_ui_edit_page(Object, 'p_display_invoice_pdf') 
call_user_func_array('views_ui_edit_page', Array) menu.inc:517
menu_execute_active_handler() index.php:27
mortona2k’s picture

I did some manual file modifications which worked, but I am stuck on this last one:

Strict warning: Declaration of PdfTemplate::addPage() should be compatible with that of FPDF_TPL::AddPage() in require_once() (line 24 of /Users/amorton/Sites/edge/edge/sites/all/modules/contrib/views_pdf/views_pdf_template.php).

Here it is in views_pdf_template.php:
public function addPage($path = NULL, $reset = FALSE, $numbering = 'main')

and in fpdf_tpl.php:
function AddPage($orientation = '', $format = '', $keepmargins = false, $tocpage = false)

They do have different capitalization.. are they different functions?

Peacog’s picture

Title: Declaration of FPDF::_putstream() should be compatible with that of TCPDF::_putstream() » Declaration of PdfTemplate::addPage() should be compatible with TCPDF::AddPage
Category: support » bug
FileSize
594 bytes

I solved the compatibility warning for addPage() by adding the missing AddPage() variables ($orientation, $format, etc) to the function declaration in views_pdf_template.php. Here's a patch.

Note that this is not a replacement for the patch in #17 as that one patches FPDI whereas this one patches Views PDF.

gettysburger’s picture

Just to be clear, #27 patches dev?

Zippy’s picture

Hi,

I applied the patch (views_pdf-declaration-compatibility-1288782-27.patch) on the lastest dev version. So far there are no warnings left now. But the patch causes a new and bigger problem. If I do any changes to the format settings ( Show: PDF Fields | Settings ) no text will be written into the pdf document and I can't undo this behaviour.

danesta’s picture

#11 did the trick for me, got rid of all the warnings. Thank you.

killua99’s picture

Priority: Normal » Critical
Status: Needs review » Reviewed & tested by the community

Exist a patch to handle this issues and others. Please see #2032189: Multiple issue fixing in a single patch and review others issues patch.

This is RTBC, and ready to apply.

candelas’s picture

#11 worked for me, thanks cardentey :)

edit: i dont know if it is because this, but i cant make things like
$content = strtoupper($content);
that you find in the tutorial.
PHP Version 5.3.10-1ubuntu3.6

i have tried in the dev version and in 7.x-1.0

killua99’s picture

Priority: Critical » Normal
Status: Reviewed & tested by the community » Postponed (maintainer needs more info)

Please update to the lasted version of the TCPDF library.

@Peacog: I'm not going to submit this patch before #27 say cause other problems. Needs a full review of it.

mikran’s picture

Issue summary: View changes
Status: Postponed (maintainer needs more info) » Needs review
FileSize
581 bytes

Patch #27 didn't apply to 7.x-1.x branch. Here is a rerolled version.

I tried to reproduce the error in #29 but it worked just fine for me.

killua99’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

kmlinantud’s picture

#22 worked for me! thank you!