Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'Template does not exist!' #3

Closed
crnm opened this issue Apr 9, 2014 · 13 comments
Closed

'Template does not exist!' #3

crnm opened this issue Apr 9, 2014 · 13 comments

Comments

@crnm
Copy link

crnm commented Apr 9, 2014

I am trying to get the example you have here to work, but I get the following error:

Fatal error: Uncaught exception 'InvalidArgumentException' with message 'Template does not exist!' in ... /tcpdf/fpdf_tpl.php:218 Stack trace: #0 ... tcpdf/tcpdi.php(244): FPDF_TPL->useTemplate(1, NULL, NULL, 0, 0) #1 TCPDI->useTemplate(1) #2 {main} thrown in ... /tcpdf/fpdf_tpl.php on line 218

I have tried with several pdf files, but I always get the same result.

I'm using the following versions:
tcpdf: 6.0.053
tcpdi: 1.0
tcpdi_parser: 1.0
fpdi: 1.5.1

Thank you in advance!

@bacu7
Copy link

bacu7 commented Apr 22, 2014

I have some problem,
problem in variable _tpls[$tplIdx] is empty, but tcpi_parser use tpls[] array, maybe left _

@jrnbos
Copy link

jrnbos commented Apr 23, 2014

I have exactly the same problem, how do I fix this?!

Very annoying. Tried everything, seems like the problem doesn't persist in the older version but I can't use this version for other reasons.

Please help!

@bacu7
Copy link

bacu7 commented Apr 23, 2014

hello,
because class FPDF_TPL is still wrong
i use alternative: I made image from template PDF and use it as image $pdf->Image

@pauln
Copy link
Owner

pauln commented Apr 23, 2014

It looks as though the version of FPDF_TPL included with FPDI 1.5 is not compatible with TCPDI. Please use the standalone version of FPDF_TPL (v1.2.3) for now - I'll look into the new version more closely and see if I can add support for it. You don't need any other parts of FPDI - just the standalone FPDF_TPL is sufficient.

@gismofx
Copy link

gismofx commented Jan 25, 2016

@pauln I have replaced version 1.5 with version 1.2.3. Same error. Do we need to change the extends FPDF TO extends TCPDF ? I did that as well and still same error. Is there a fix?

I think there may be an error in importPage Function? I can't seem to figure it out.

@crnm, did you find a solution?

@bacu7, can you share a sample of your work-around?

@pauln
Copy link
Owner

pauln commented Jan 25, 2016

Hi @gismofx, as per my initial response to the issue you logged as pauln/tcpdi_parser#11, please either attach the troublesome PDF(s) here, or email them to me at tcpdi-samples at next.gen.nz so that I can investigate further.

@gismofx
Copy link

gismofx commented Jan 25, 2016

@pauln I've emailed you the files(PDF and php script)
For reference in this thread, here's the Stack Overflow Question

@pauln
Copy link
Owner

pauln commented Jan 26, 2016

@gismofx It all seems to work fine for me, both using the PDF file you sent me and the Base64 data from the pastebin. Have you tried writing the submitted data (Base64 decoded) to a file to confirm that it's being submitted properly? If the data is being submitted (and Base64 decoded) correctly, can you please send me a zip of your full code (PDFMerge.php plus all TCPDF/FPDF_TPL/TCPDI/TCPDI parser etc files, preferably including whatever you're using to submit the PDF data to PDFMerge.php), so I can see if it's an incompatibility with a specific version of one of the libraries?

@gismofx
Copy link

gismofx commented Jan 26, 2016

@pauln , I've emailed in the full folder. It's a large attachment, please confirm receipt. I am able to submit the encoded data, decode it with PHP, re-encode it, and then echo the encoded string. My application can take that encoded data and make the PDF without a problem! I appreciate you looking into this.

@pauln
Copy link
Owner

pauln commented Jan 26, 2016

@gismofx, I received the file successfully. The copy of the code you sent me is attempting to use FPDF_TPL version 1.6.1 (bundled with FPDF); if you download the standalone version 1.2.3 from https://www.setasign.com/products/fpdi/downloads/#files (as per the TCPDI installation instructions) and put fpdf_tpl.php directly into the FPDF/tcpdf directory (so it sits alongside tcpdi.php and tcpdi_parser.php) and revert the require_once in tcpdi.php (to require_once('fpdf_tpl.php');) it should hopefully work for you.

As above, I'll try to find time to look at compatibility with the newer versions of FPDF_TPL bundled with FPDF - but for now, the above should hopefully work.

@gismofx
Copy link

gismofx commented Jan 26, 2016

@pauln Thank you! I had the libraries mixed up! It's working correctly now on my end. I'll keep an eye out for when the new version is compatible. Also, I will happily test it when the time comes.

@jaspreetkaur
Copy link

Hi pauln,
I have followed all the steps mentioned by you.
if i add : require_once('fpdf_tpl.php');
Got an error: Cannot redeclare class FPDF_TPL in /var/www/html/sample_pdf/fpdi/fpdf_tpl.php on line 0.
Please help me.

@pauln
Copy link
Owner

pauln commented May 27, 2016

@jaspreetkaur, please don't hijack issues - your problem does not seem at all related to the issue being discussed here, so please use the "New issue" button to start a separate one. When you do so, please explain clearly what you've done and what's happening - and consider making your code available, as that will make it much easier to help you.

@pauln pauln closed this as completed May 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants