Where do I add css styles to theme the generated PDF? Is it done within this module or from a file in TCPDF?
cheers
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | Capture.JPG | 11.27 KB | andreavr |
| #11 | Screen Shot 2016-08-23 at 12.23.33 PM.png | 5.86 KB | jeff.a |
Where do I add css styles to theme the generated PDF? Is it done within this module or from a file in TCPDF?
cheers
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | Capture.JPG | 11.27 KB | andreavr |
| #11 | Screen Shot 2016-08-23 at 12.23.33 PM.png | 5.86 KB | jeff.a |
Comments
Comment #1
mr.york commentedWebform2pdf not supported external css files.
Comment #2
denes.szabo commentedYou can use inline styles in the body, see this example:
I used it in a pdf body field and works fine. Of course, you can not use all fancy css tricks, but the basic formatting usable. You have to take care your input format do not suppress the style element.
Comment #3
jami3z commentedI needed far greater theming control than just css, like being able to change the layout of the results in the pdf.
So my solution was instead of outputting just the %email_values token in the "content of the PDF document", I constructed my output with standard html, inline css and all the individual token elements so that I could display all the values in a nice layout with labels and page breaks etc.
Worked great, just a pain to have to write it all up.
Comment #4
cehfisher commentedI would love to see an example of layout using tokens. I have had a hard time trying to configure the PDF output. Can you post an example jamienotweet?
Comment #5
rsccarc commentedIn the "Content of the PDF document", you can use HTML tags enclosing token values. For example :
<p><strong>Label</strong> : %value[token_id]<p>Yet, it appears that some CSS tags aren't recognized :
<span style="float: left; width: 5em;"><strong>Address</strong></span> : %value[address]renders the same as
<strong>Adress</strong> : %value[adress]Can anyone confirm this point, and eventually give a clue about it ? Thanks in advance ;-)
Comment #6
denes.szabo commentedI think, your input format has a filter (correcting html tags, html tag filter) which causes this result.
Comment #7
rsccarc commentedThanks for taking time to answer :)
I checked all my components, and it seems that I don't have html filtering. I just have a "webform validation" module, only to have regexp controls.
In order to be sure, I created a new webform with a single textfield and no validation rules. I specified a generated PDF file with only a static text. The code I wrote in the "content of the PDF document" is :
The output text format is "Full HTML" but the PDF generated is the same as if I wrote this code :
Comment #8
rsccarc commentedI spent half a day looking for tricks and others informations. It seems that TCPDF doesn't support CSS instructions like float and width.
So, I managed to design my PDF page with the dirty old techniques of the tables, rowspan, colspan and so on... *gasp*
Therefore, I will keep an eye on the TCPDF evolutions, waiting for CSS full support :-)
Comment #9
mel-miller commentedI am in the process of doing the same thing.
Does anyone know how to make empty webform fields show up blank rather than with the tokens in brackets? For example, I have an optional field, and when people leave it blank it prints out the last two parts of the token like this "[copresenter1][first_name_1] "
Comment #10
nessunluogo commentedI know this is an old thread, but i'd like to know more about the solution of jamienotweet.
It looks like I need something similar.
Comment #11
jeff.a commentedAnyone know if
<style>tags are still supported? Inline css is working fine for me, but I can't get<style>tags working. The example below just generates*/in the pdf. Screenshot attached.Comment #12
andreavr commentedHi there,
Just tested on a form I'm doing and it does work - do you have the text format as Full Html?
Andrea
Comment #13
only4kaustav commentedHi All,
I am also facing the same issue which is describe on #11. Can anyone help on this?
Thanks
Comment #14
eryopse commentedHi, remove the filter
in the format Full HTML.
It works for me.
Comment #15
IowaBoy commentedI am trying to style my pdf. I have it so it differentiates the styling for the label vs the response. I am trying to style the Fieldset Title/label so it stands out from the other two. I tried custom class in the fieldset configuration but I still cannot seem to find the correct CSS Selector. How do I locate the need CSS Selectors?
label {font-weight:bold; color:grey; } fieldset {color:red; }[submission:values]
Comment #16
abarpetia commented@IowaBoy, did you manage to get your CSS selectors working? I am also trying to do the same. thanks
Comment #17
raywright commented#14 worked for me to remove that */ at the top of the rendered PDF - thanks a million!