aa2007’s picture

Issue summary: View changes

Question with "width" resolved.

aa2007’s picture

Issue summary: View changes


nguyentran’s picture

I have the same problem, any help !

kaizerking’s picture

6.34 KB
6.55 KB

same problem here any help please.
and also if some some can help on following:
1.table with borders
2. setting font size in the rows, currenly only we can set header
3 setting column width
4. if in unformatted setting, how to display multivalue fields -currenly, if it is multivalue field displaying one over the other
please have look at the attached pdf

PS: please clarify if we are styling it with positions, does this means that we cannot generate a dynamic page with multiple values? always same fields and what if user adds more values for the fields ?

nguyentran’s picture

Hello kaizerking,
I have a temporaly way to add border is
Format>settings> render settings> in PHP Code Before Output ,
You set $border = 1; the same way for other fields, You will get the border.

Setting font size in the rows
Format>settings> Text setting> font size

I don't know how to set width of column.

I have this problem with label, when i check the option 'Create the label', i also have the label in the content (like the pdf file include) Can you help me to fix it. Thanks

nguyentran’s picture

33.05 KB

This is file PDF

kaizerking’s picture

I am using field collection module which is an entity in it self, So when i am generating a view,views pdf identifies as content type and the label is the same time it wont recognize the fields inside the field collection item, that is the reason i am not able to set the format values to the rows and fonts. if i assign any value the will only apply to the label and not the rest of the content
I think the maintainer should consider this, now in D 7- entity , entity reference, bundle are used extensively
For you perhaps if you know coding, you can visit TCPDF and read and see how you could solve your problem, I am not coder

bofrost’s picture

@kaizerking #5
Maybe you have to edit your view and use the fields inside the field collection with a relation...

@nguyentran #3
I think the actual DEV Version will fix your Problem, have a look to this issue

bofrost’s picture

Assigned: aa2007 » bofrost
nguyentran’s picture

Thank you Drupaldise, the patch work well.
I need your advices for this. I have read a lot on these issues, but i can not find out how to create the table, and how to put the code into the 'Render settings' (the way to use the variables and TCPDF API), i read the examples from but it not suitable for code in 'Render settings'.
Thanks for helping.

nguyentran’s picture

32.79 KB

Hi, i am using variable $border =1; but it not work as demand (see my included file)

lsolesen’s picture

Title: PDF table » Display borders on PDF table
saqib055’s picture

24.84 KB

hey can some one give me the solution for the border problem.. i see this is deviating from border related problem to field label related problem. #5 solution gives me border to the label but thats not exact solution i suppose.

thank you in advance.

killua99’s picture

Assigned: bofrost » Unassigned
Status: Active » Postponed (maintainer needs more info)
Issue tags: +Needs steps to reproduce

Dear fellow Drupal enthusiasts,

I have set this issue to "Postponed (Maintainer needs more information)".

If not already done please add an issue summary and steps how to reproduce the problem.
And please read again, "Making an issue report".

Help about how to do this can be found on IRC and in the user groups.

After there is new information, please re-open the issue by changing the status to active.

This issue was edited with the help of Issue Helper

candelas’s picture

if you use css, you can assign borders to the table (tested on dev)

darkodev’s picture

Confirming #13

Assign a css file in the pdf settings and add

th, td {
  border: 1pt solid #000;

Now how do I get cell padding?

I set a td class = "description" and tried to add css padding, but no joy.

I can only apply padding to whole table, it seems:

table {
  padding: 2pt;
darkodev’s picture

Issue summary: View changes


pritimhjn’s picture

$border = 1; doesn't work to set border for table.
Also CSS file is not getting called, i tried with sites/all/themes.. in CSS url.
No luck!

Please help.

killua99’s picture

with full path ??

mkozhuharov’s picture

Issue summary: View changes
7.72 KB

Hi everyone,

In my case "$border = 1;" works for table format, but the cells height is different, depends on how much content is in it.

I tried to apply css file but it doesn't work...

Any ideas how I can set the same height per table row ?

rudy2342’s picture

"$border = 1;" is not working for me. Whenever I put it into the php code before output, it will just over write my field with the actual text of $border=1; and not apply the border. If i use php tag then the whole field goes blank and there is no border. Am I doing something wrong? Do you just put "$border = 1;" inside PHP Code Before Output under body style?


killua99’s picture

Did you try #13 ?

killua99’s picture

Status: Postponed (maintainer needs more info) » Closed (works as designed)

Please reopen if you have other solutions for this.

lennartvv’s picture

Version: 7.x-1.0-rc1 » 7.x-1.3
Component: User interface » Code
Status: Closed (works as designed) » Needs work


I'm reopening the issue because it's not working as designed (7.x-1.3) as it is marked now. Both CSS and "$border = 1;" are not working so the table is not themable.
However, when adding classes to values in the table using field rewriting, those can be themed using a CSS file.

So conclusion: values can be themed, the table itself cannot be themed.

Is it a possibility to apply the given CSS file to the whole table instead of applying it to each individual field as it does now (and as it is described when adding a CCS file: URL to a CSS file. This file is attached to all fields, rendered as HTML.)?

To reproduce this issue you simply need to setup a view with a pdf table display (using 7.x-1.3 of views_pdf) and try to theme the table itself by adding borders and paddings using the CSS or PHP methods. If you succeed, I'm really keen to know how it's done.


lindaweb’s picture

Is'nt there any documentation to assist on styling the pdf.

Whats the purpose of having this functionality if one is unable to style the pdf ?

I have tried importing a style sheet, none on the changes reflect. I have tried some of the above mentioned solutions , again with no effect.

I have a drupal system that calculates fields and import secondary content types to compile
estimates according to required templates. Everything is working and being shown in the views pdf, nut the table borders are not showing, the css styling is not snowing .. nothing !!.

I am unabe to add classes to any of the fields
The only value that i see being called in the viewers.css from Firefox.

PLEASE can there be looked at supplying proper documentation on styling views pdf.
Im using Views PDF 1.3 on Drupal 7
This is now becoming a frustrating endless battle.

milton_segretti’s picture

14.99 KB
59.32 KB

I'm not working with the actual "PDF table" setting but the "PDF Unformatted". My content that is going to make the PDF has an html table in it though. Here are my observations which may be of some use.

If you are using a pdf template, to provide a background image for the pdf for example, it seems to be slotted in-between the text in the table and any borders applied to the table using a css file. Removing the template makes the borders appear. I have added screenshots of the same table with and without the template:

templateno template

Any inline styles on the html table will override the css file. The table on mine is pasted from excel so there is of course lots of inline styles added.

vegansupreme’s picture

@Lindaweb for styling see the bottom of Views PDF Gotchas

I'm pretty sure the tables created by 'PDF Table' format aren't actually HTML tables. So using CSS table styling won't work unless you have a table within your field.

$border = 1; won't work in PDF Table format for 7.x-1.3 because only unformatted has the bypass PHP_eval option.

Here's my workaround:
This patch adds bypass PHP_eval option to PDF table format.
Apply patch.
To add borders to your table, add $border = 1; to PHP Code Before Output and check the Use PHP eval box. Do this for every field. This will only put a box around each field, not the whole table. If your fields have different heights it will look weird. See comments #9 and #17. To solve this problem add a $h value to the PHP before field. This will make the height of each cell consistent, and your table will appear to have borders. You may need to experiment to find the right $h value. This value is in the units specified in the PDF Page Options (mm by default). Unfortunately this value has to be at least as tall as your tallest field—It's not a perfect workaround. If using mm, you could start with $h = 15;

I'l dig around some more in the code to see if there's a better way.

killua99’s picture

This patch should be committed ? or should I wait for some feedback?

vegansupreme’s picture

It's just applying the same bypass php_eval patch that was applied earlier to unformatted. I think it should be okay.

killua99’s picture

Version: 7.x-1.3 » 7.x-1.x-dev

Alright. Someone can RTBC ?

maxplus’s picture


Thanks for the patch but when using a template pdf, the table borders are gone...

lindaweb’s picture

The tables and the css will only show correctly , if your server PHP config settings are setup correctly.
allow_url_fopen : On
ioncube : Off
memory_limit : 64 MB
max_execution_time : 30 Seconds
max_input_vars : 2500 Variables
upload_max_filesize / post_max_size :2 MB

MeeraKB’s picture

Tried both CSS file and $border = 1; but didn't get the result .

NWOM’s picture

Status: Needs work » Closed (outdated)

The patch from #24 has already been committed. It appears this issue is outdated.