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

  • Home
  • SEARCH
  • 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 962429
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T01:30:18+00:00 2026-05-16T01:30:18+00:00

I have to generate a PDF with TCPDF, my information come from my database,

  • 0

I have to generate a PDF with TCPDF, my information come from my database, so I have to write PHP variables. I know how to do.

But I want to write CSS + xHTML (as an example I have seen of TCPDF site) using :

$html = <<<EOF

<style>
  <!-- My CSS -->
</style>

  <!-- My xHTML -->

EOF;

$pdf->writeHTML('$html', '');

I have errors when I try to open the PDF. I have read I must escape the ‘$’ with ‘\’. After this, I have no error, but the content of my variables doesn’t appear in my PDF.

EDIT :

@Sarfraz: I don’t see how can I do this if I do this, it doesn’t work ?

$html = <<<EOF

    <style>
      <!-- My CSS -->
    </style>

      <!-- My xHTML -->
      <span><?php echo $myVar; ?></span>

    EOF;

    $pdf->writeHTML('$html', '');
  • 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-05-16T01:30:19+00:00Added an answer on May 16, 2026 at 1:30 am

    Make sure that there is no space and indentation before EOF; otherwise you will get error.

    Also if you have any variables in heredoc syntax escape put them in {} like {$somevar}

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

Sidebar

Related Questions

We have a requirement to generate PDF documents using information from a PDA /
I have a PHP application and a need to generate a PDF with the
I have a PDF that is being generated from HTML source using HTMLDOC. While
i'm want to have a repeater generate a bunch of checkboxes, e.g.: <tr><td><input type=checkbox
I have 3 PDF documents that are generated on the fly by a legacy
I have to generate two random sets of matrices Each containing 3 digit numbers
For testing purposes I have to generate a file of a certain size (to
I have a new app I'll be working on where I have to generate
At work I work closely with MS-Office. I have managed to generate some scripts
I have a old website that generate its own RSS everytime a new post

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.