• Resolved ajg-cal

    (@ajg-cal)


    Hi Lewis

    do you know the best way to get table borders in the pdf?

    I noticed that tcpdf has pretty basic css support. I not sure if it can parse the styles used by modern wordpress themes for tables (?), and that’s why my tables (link) show up without borders in the pdf.

    but the html attributes

    <table cellspacing=”1″ cellpadding=”1″ border=”1> do have an effect on the pdf, unlike the css. I thought border=”1″ would put borders around all the cells, which is what I want, but it puts a border around the outside of the table only.

    here’s a tcpdf example (link)

    thanks again

    let me know if there are any new versions I can test.

    I’ll stop spamming now…

    Alex

    https://wordpress.org/plugins/wp-post-to-pdf-enhanced/

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Author Lewis Rosenthal

    (@lewisr)

    Fed back is good, Alex; please don’t feel like you’re spamming. I appreciate the time you put into finding these things and providing examples.

    Tables:

    Make sure that there really is a closing tag (I expect there is). Also, you might try the css as described here or test the <hr> tag as mentioned here not that I’m a huge stackoverflow fan, but these seemed to bubble to the surface rather quickly. Finally, it’s good to have a look at Nicola’s examples. Maybe there’s something else we need to do to properly massage the output (read: apply another transform from TCPDF) or just watch the tags and styles. His examples are the standard.

    I’ll spend some time as soon as I can reviewing these table issues.

    As for new versions, still working out png images with alpha channels in the header (vs the body) in order to update the TCPDF class, but I have a new footer capability I’m testing along with an expanded (and hopefully slightly better organized) admin UI. I’ll push it to trunk soon (been waiting on some feedback from Susan on the footer thing, though it seems to work pretty well for me.

    Cheers

    Lewis

    Thread Starter ajg-cal

    (@ajg-cal)

    Hi Lewis

    Here’s the code taken from your link and with the html inserted used on this page and the CSS placed in the Custom CSS area of the plugin’s admin interface; I think that’s all correct? but you can see it in case there’s an error

    thing I’ve tried

    1. remove the thead tag (link)
    2. disable process shortcode and plugin styles
    3. changing themes
    4. disable table styling that comes with themes
    5. deleting all other plugins
    6. turning off wpppdf other settings in case of conflict (header, footer etc)

    In terms of table border, the result seems to be the same throughout. You can see that some of the styles are applied successfully (e.g. text-align: center;).

    Thread Starter ajg-cal

    (@ajg-cal)

    still to try:

    make a small box div with same borders and see if that works or if it’s particular to tables

    Thread Starter ajg-cal

    (@ajg-cal)

    I can get a table border to work with this CSS

    table, td, th {
    border-style: solid;
    border-width: 2px;
    border: black;
    }

    but no luck with the cells and headers as yet

    Plugin Author Lewis Rosenthal

    (@lewisr)

    Hmmm… Tables are indeed a challenge. Have you looked at Example 61 here?

    I’ve had my head into a site revamp and some nagging database issues the past few days, which is why I’ve seemingly fallen off the face of the Earth, but I’m still here. πŸ˜‰

    I’ll take a closer look at tables ASAP.

    Thanks, Alex!

    Cheers

    Lewis

    Thread Starter ajg-cal

    (@ajg-cal)

    Hi lewis

    no rush

    take your time

    Plugin Author Lewis Rosenthal

    (@lewisr)

    Well, some progress.

    First, I looked at your test table 01, Alex. Then I copied it. πŸ˜‰

    I use the CKEditor plugin, which (for me) makes editing tables much easier. I picked up on a css class for the table which came over in the copy:

    mceItemTable

    On my test site, I added the following for the plugin’s CSS:

    table.mceItemTable tr td {
      border:1px solid red;
    }

    This gets me 1px borders around the table (sans the column headings, which I have yet to figure out).

    However, I can’t seem to make the same thing work on your site. Perhaps the CSS class was added by my editor when I did the paste, as I haven’t been able to find it in your page at all.

    BTW, if I include th, I lose the borders. My grasp of CSS isn’t masterful enough that I can spot what’s not quite right, but given time and the proper tools – and research materials! – it’s liable to come to me. πŸ˜‰

    Here’s another test table with borders around the cells, as well as some formatting applied to the column headings.

    The css for this is simply:

    th {
      font-weight: bold;
      color: #636363;
    }

    Note the column headings. In the browser, they render with:

    text-transform: uppercase;

    and unfortunately, TCPDF does not recognize text-transform, as Jenny found out here.

    The workaround, of course, is to enter the text in upper case, and if necessary, then, apply an override in the opposite direction, e.g,:

    text-transform: capitalize;

    (or however to suit) for the web rendering (so obviously, this would not go into the plugin’s CSS overrides).

    So, in short, some progress, but not a complete solution. The important thing to note, as you discovered, is that even with borders specified in the editor, they must still be applied in the plugin’s CSS overrides, or they are ignored.

    Cheers

    Lewis

    Plugin Author Lewis Rosenthal

    (@lewisr)

    Had a chance to dig into this again, Alex? Just curious to see if you’ve made any new discoveries. Tables and PDF forms are next on the list of things to tighten up, I think (and, well, the whole image alignment debacle).

    Cheers

    Lewis

    Thread Starter ajg-cal

    (@ajg-cal)

    Hi Lewis

    I’ll take a look tonight on a fresh wordpress installation and the latest revision from the trunk (?)

    Sorry I disappeared – I’ve just moved home.

    Plugin Author Lewis Rosenthal

    (@lewisr)

    No worries, Alex; just checking in. πŸ˜‰

    Cheers

    JJ

    (@juliej82hotmailcom)

    Any other tips on this? I’m having similar problems trying to get cell borders to show in the PDF…

    in the development version, it works great with the borders… but not with 1.0.5
    Perhaps this hint helps!?

    JJ

    (@juliej82hotmailcom)

    It does. I download the dev version and used

    table, td, th {
    border 1px solid black;
    }

    in the plugin CSS settings. Thanks!

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘question: table borders in pdf’ is closed to new replies.