Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8111353
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T02:05:02+00:00 2026-06-06T02:05:02+00:00

By default, the values within tables cells (within tables generated by TCPDF) are vertically

  • 0

By default, the values within tables cells (within tables generated by TCPDF) are vertically aligned right at the top of the cell.

Has anyone found a simple method for vertically aligning text to the middle of the cell?

I have found a couple of proposed solutions online but these don’t strike me as ideal.

For example one suggestion (http://sourceforge.net/projects/tcpdf/forums/forum/435311/topic/4385696) is to set the contents of each cell using TCPDF’s MultiCell() method, but this is a pain when you simply want to write out your HTML code and then generate the PDF.

Another suggestion (http://bytethinker.com/blog/tcpdf-and-vertical-alignment-of-table-cells) is to place spans within each cell and create blank lines with line breaks in these spans in order to force your text down (and thus towards the vertical centre), but this is a bit of a hack.

Has anyone found a better / cleaner way to achieve this? Surely a library this popular would cater for such a common requirement?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T02:05:04+00:00Added an answer on June 6, 2026 at 2:05 am

    Remember that TCPDF cannot handle full-blown HTML and CSS the way a browser can. Nicolas has done a good job of rendering the most-used HTML codes. CSS cannot be placed at the top of the document, it must be put inline.

    Tables must be formatted completely manually–cells do not auto-size the way they do in a browser. Likewise, you must figure out how tall something is and add <BR>s or size an invisible image to push it down if you want.

    Perhaps one day he will add more of this functionality. As it is, I find the class amazing.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I inherited a system that stores default values for some fields in some tables
I was wondering: Is it possible, to provide default values within the pattern of
What is the default values for members of a struct and members of a
How can I have a localized default values in the Settings bundle? I encounter
I'd like to remove all default values that have been setup in a particular
I have some questions about the default values in a function parameter list Is
Should I frequently rely on default values? For example, in PHP, if you have
In Symfony how to set default values to sfWidgetFormDateRange from action
I need to clear the default values from input fields using js, but all
What use are they if they cannot be altered from their default values anyway?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.