Some questions about TCPDF

saddys 23 Sep, 2016
Hi,

I have some questions about TCPDF v5 on CF5 / J2.5.

I have a form that have some custom rule, one barcode generator, a DB SAVE, email send with barcode, and a display msg (i display a custom code with barcode img src and a part of "display msg"). And for now it is all ok. Put data in the form, submit, save on DB, send email with my graphics and barcode img, and then display a thanks msg with the barcode (from custom code). All ok.

Now I install TCPDF because i want to attach one pdf with form-data and barcode to the email, so I set to SAVE ON SERVER, i try to set in content of pdf some words (for a try), but:

1) when i submit the form, the explorer download the pdf but all still locked on form (don't display my thanks message). I try to put TCPDF at last action, at first action, everywhere, but nothing to do, the page remain stopped in form. (I set SAVE ON SERVER)

2) if I open the downlaoded PDF, the content text is the customs code and no the "display msg" (and no the content set on options of TCPDF). I have a barcode in the customs code that, without TCPDF INSTALL ACTION, i can see in Thanks Msg (it's like a img src <img src='".JURI::base() ."components/com_chronoforms5/includes/barcode.php?barcode={barcodefull}&width=320&height=80' />";), but in downloaded PDF i can't see any the img

Someone can gently help me? Thanks
GreyHead 23 Sep, 2016
Hi saddys,

1) If you have the PDF set to download then ChronoForms loses control of the browser and so you cannot display a message. (Some browsers behave differently.) The most reliable method I have found is to save the pdf to the server and include a download link in the Thank You message - that way you can have both..

2) There are problems with image handling in the TCPDF code - IIRC if the link starts with http then TCPDF will try to use cURL to download it. If you change the link to /components/com_chronoforms5/includes/barcode.php?barcode={barcodefull}&width=320&height=80 then it might work OK

BUT this link isn't an image it calls a PHP file so there is every chance that it won't work embedded in TCPDF*. You could use a Custom Code action before the TCPDF action to create the image, save it on the server and then link to the saved image in the TCPDF.

Bob

* And it might throw a PHP error which is breaking your TCPDF template code.
saddys 23 Sep, 2016
Hi Bob,

I have read in other your reply that ChronoForms loose control, but the problem is that chronoforms loose control with SAVE ON SERVER too (perhaps on my form).

First I want to resolve this issues, then try with image in pdf.

Thanks,
Saddys
GreyHead 23 Sep, 2016
Hi saddys,

Maybe you are seeing some kind of PHP error in creating the pdf file - there isn't enough information here to say much else.

By all means PM me the site URL, the form name, and a SuperAdmin login and I'll take a quick look.

Bob
saddys 26 Sep, 2016
thanks, you have a PM.
GreyHead 26 Sep, 2016
1 Likes
Hi saddys,

I have made a copy of your form and made some improvements.

You have a lot of broken PHP:

+ the generateIdent() function is in a separate custom event which means that it is not available to use where you are calling it. The PHP scope is limited to the current custom event.

+ You have some strange PHP that I couldn't work out generating a the code string for the barcode, I think that is now all OK.

+ There is no image matching the coupon 1234 so that fails, I tried another one OK.

+ There is not File Name or Save path set for the TCPDF action so the pdf file isn't saving but is displaying immediately and including the contents of the Display Message action. If you fix this then test I think it should be OK apart from the barcode image.

Bob
saddys 26 Sep, 2016
Thanks Bob.

I look the new form...

you write: + There is not File Name or Save path set for the TCPDF action so the pdf file isn't saving but is displaying immediately and including the contents of the Display Message action. If you fix this then test I think it should be OK apart from the barcode image.

I try with a FILE NAME, with a SAVE PATH, but when i submit the form, still to open pdf in browser / save with a name like "namefor_yyyymmddhhssmm".

For a try I have: installed chronoforms on another my joomla site, restored my form, install action tcpdf with basic function (without name or seth path) and all is ok (i see the display message)!!! so i don't understand where is the problem😟
saddys 26 Sep, 2016
if you can try, i create a /omaggiopdf folder ... try without problems with casual text data in the form, with coupon "gabri8u", you can see that the pdf crash the batch.. thanks
kate_ee 12 Nov, 2016
Hi There,

I installed the TCPDF on Chronoform v4 , and found there are lines at the top and bottom on each page. How can I get rid of these lines? Thank you in advance !

Kate_ee
GreyHead 12 Nov, 2016
Hi kate_ee,

You would need to hack the code to remove the header and footer rules. The TCPDF action is a basic implementation of the TCPDF library and has limited options. I do have a much-hacked version of the CFv5 version of the action where I have experimented with changing and adding options but I suspect that it would be simpler to start from scratch using the TCPDF library.

Bob
kate_ee 14 Nov, 2016
Somebody in GOOGLE SEARCH answered , and works perfectly now, thank you for answering anyway.
This topic is locked and no more replies can be posted.