Dynamic images/figures

1 June, 2021 03:25:42
jorgellomb98
Topics: 10
Messages: 19
Hello,
I will provide some context about my need first:
I have a quiz, for which certain different types of scores are calculated with js.
Once finished by the user, what we intend is to show these scores in a full pdf report.
It would be interesting to add some very basic graphics showing the user's scores. Something very basic, like a rectangle, being larger the higher the scores are.
My question thus is, how can I change the size (and, if possible, also the colour) of the "rectangle" shape as a function of these js variables?. (I could import/take the data of these variables to the e2pdf environment by, for instance, creating invisible fields in a form, and then filling them with js. Thus my real question could also be, how can I change the size and colour of the "rectangle" shapes as a function of the numerical inputs in these forms?).
If it is not possible, do you have any other idea how I could achieve this?
Thank you
1 June, 2021 03:38:28
E2Pdf
Support
Topics: 7
Messages: 3163
Hi,

It looks like you need to use "Actions" and "Conditions". It will be need to use some "hidden" field which will have some value by which you will switch properties/values. For example for "Rectangle" you must be able to change color / size. For images you can set custom image and change it's width / height.

See please screenshots attached with example.

P.S. Unfortunately "width" and "height" can't be set as some dynamic value from the form directly, it can be set only as number inside "Action" at this moment, however we will review to add its support.

We remain at your service.


We would really appreciate your feedback at WordPress.org!
1 June, 2021 04:05:57
jorgellomb98
Topics: 10
Messages: 19
Hello,
Thank you for your answer.
I think this will suffice our need.
I have just one last question, how can I put the value of a field (an invisible one) of the form in these conditionals? in the instructions it says that I should use a "shortcode", which one/how exactly?
Thank you
1 June, 2021 04:19:24
E2Pdf
Support
Topics: 7
Messages: 3163
If you are using "Formidable Forms" it's just simple shortcodes which is available under Formidable Forms Success Message / Mail Body / Views / E2Pdf Template Visual Mapper. Usually it's [field_id] (for example: [123]) or field key (for example [x95hs]), some extended shortcodes as [123 show="value"] (If checkbox separate values).

To see which value is rendered by E2Pdf you can just create simple "textarea" with needed shortcode and see its output on needed entry. It will be rendered in same way inside "Actions" and "Conditions".

P.S. "Hidden" field not showing inside "Visual Mapper" however you must be able just to use as [123] without issues, where 123 is Hidden Field ID inside Formidable Form.

If you are using other forms then it must be used shortcodes which is available exactly for that extensions.

We remain at your service.
We would really appreciate your feedback at WordPress.org!
1 June, 2021 04:22:21
E2Pdf
Support
Topics: 7
Messages: 3163
Formidable Forms Field ID
We would really appreciate your feedback at WordPress.org!
1 June, 2021 06:29:36
jorgellomb98
Topics: 10
Messages: 19
Hello,
Thank you for your answer.
One last question:
-Is there any limit on how many conditions/actions I can put per object? I would probably need to put 100-120 in each rectangle.
-Is it possible to copy and paste these conditions and actions into other objects (in order not to have to rewrite all of them again)? Keep in mind that my reports will have more than just one page, so I would need to copy these objects (with their respective actions and conditions) or the actions/conditions per se, and then paste them in different pages, would it still be possible?

Thank you
1 June, 2021 06:45:54
E2Pdf
Support
Topics: 7
Messages: 3163
There is no actually limit on "Actions" and "Conditions" however it can affect speed of PDF generation.

As about copying:

If you will create object and will put "Actions" and "Conditions", after this copy this object - it will contain all "Actions" and "Conditions". Unfortunately copying "Actions" and "Conditions" separately doesn't supported yet.

We remain at your service.
We would really appreciate your feedback at WordPress.org!