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.
Comment | File | Size | Author |
---|---|---|---|
#34 | views_pdf-declaration-compatibility-1288782-34.patch | 581 bytes | mikran |
#27 | views_pdf-declaration-compatibility-1288782-27.patch | 594 bytes | Peacog |
#17 | views_pdf-declaration-compatibility-1288782-17.patch | 2.22 KB | tstaylor7 |
Comments
Comment #1
jbiechele CreditAttribution: jbiechele commentedMaybe 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
Comment #2
jbiechele CreditAttribution: jbiechele commentedI 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?
Comment #3
jbiechele CreditAttribution: jbiechele commentedI 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.
Comment #4
jbiechele CreditAttribution: jbiechele commentedComment #5
sorensong CreditAttribution: sorensong commented+1
Comment #6
cardentey CreditAttribution: cardentey commentedHe 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
Comment #7
hregis CreditAttribution: hregis commentedThis 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.
Comment #8
jbiechele CreditAttribution: jbiechele commented@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.
Comment #9
frankiedesign CreditAttribution: frankiedesign commentedOk, 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.
Comment #10
seblecz CreditAttribution: seblecz commentedSame 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?
Comment #11
cardentey CreditAttribution: cardentey commentedPlease download from this link:
https://docs.google.com/open?id=0B9abz0DM6s8BOF9TbFF5Y200Y00
Comment #12
bendev CreditAttribution: bendev commentedthanks 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
Comment #13
juankvillegas CreditAttribution: juankvillegas commentedbendev, did you find how to fix the issue with that last warning?
Comment #14
bendev CreditAttribution: bendev commentedNot yet, if I find it out I'll post it here
Comment #15
luuuukke CreditAttribution: luuuukke commentedsubscribing
Comment #16
patman1706 CreditAttribution: patman1706 commentedjust 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...
Comment #17
tstaylor7 CreditAttribution: tstaylor7 commentedHere 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.
Comment #18
hectorelgomez CreditAttribution: hectorelgomez commentedThanks, it works perfectly.
Muchas gracias, funciona a la perfección.
Comment #19
Simon Georges CreditAttribution: Simon Georges commentedComment #20
gettysburger CreditAttribution: gettysburger commentedI 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?
Comment #21
gettysburger CreditAttribution: gettysburger commentedHas 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.
Comment #22
juankvillegas CreditAttribution: juankvillegas commentedThis combination is working for me. Use it at your own risk. http://www.papayamedia.com/sites/papayamedia.com/files/fpdi-tcpdf.zip
Comment #23
azcn2503 CreditAttribution: azcn2503 commentedGood 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.
Comment #24
Simon Georges CreditAttribution: Simon Georges commentedClosed #1944528: Declaration of PdfTemplate::addPage() should be compatible with TCPDF::AddPage as a duplicate of this one.
Comment #25
pmol123 CreditAttribution: pmol123 commentedI made the above change. Upon saving a PDF view I get the following:
Comment #26
mortona2k CreditAttribution: mortona2k commentedI did some manual file modifications which worked, but I am stuck on this last one:
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?
Comment #27
Peacog CreditAttribution: Peacog commentedI 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.
Comment #28
gettysburger CreditAttribution: gettysburger commentedJust to be clear, #27 patches dev?
Comment #29
Zippy CreditAttribution: Zippy commentedHi,
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.
Comment #30
danesta CreditAttribution: danesta commented#11 did the trick for me, got rid of all the warnings. Thank you.
Comment #31
killua99 CreditAttribution: killua99 commentedExist 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.
Comment #32
candelas CreditAttribution: candelas commented#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
Comment #33
killua99 CreditAttribution: killua99 commentedPlease 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.
Comment #34
mikran CreditAttribution: mikran commentedPatch #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.
Comment #35
killua99 CreditAttribution: killua99 commentedc0eaabac4c927a
Comment #37
kmlinantud CreditAttribution: kmlinantud commented#22 worked for me! thank you!