Home  >  Article  >  Web Front-end  >  Why Does Inline CSS Fail to Display in TCPDF?

Why Does Inline CSS Fail to Display in TCPDF?

Mary-Kate Olsen
Mary-Kate OlsenOriginal
2024-10-24 11:45:29557browse

Why Does Inline CSS Fail to Display in TCPDF?

Why Inline CSS May Not Display in TCPDF

When attempting to incorporate inline CSS into HTML while using TCPDF, a blank page may result. This occurs because TCPDF only supports a limited range of CSS attributes.

Specifically, the following CSS attributes are supported by TCPDF:

  • font-family
  • font-size
  • font-weight
  • font-style
  • color
  • background-color
  • text-decoration
  • width
  • height
  • text-align

Removing unsupported CSS attributes from the HTML code may resolve the issue.

Moreover, TCPDF has a dedicated forum for discussions related to its usage.

For alternative PDF generation libraries, consider:

domPDF

Key Features:

  • Supports most CSS 2.1 and some CSS3 properties, including @import, @media, and @page rules.
  • Accommodates external stylesheets, both local and remote.
  • Enables the creation of intricate tables with row and column spans, distinct border models, and customizable cell styling.

mPDF

Example Showcase:

  • Visit these links for demos and examples of both PHP and generated PDF.

Please note that TCPDF's documentation and the domPDF website provide comprehensive information regarding these libraries.

The above is the detailed content of Why Does Inline CSS Fail to Display in TCPDF?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn