SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Apr 2004
    0 Post(s)
    0 Thread(s)

    How to generate content dynamically using HTML2PDF


    I'm struggling with something that I thought would be more straightforward. Hopefully it is and I'm just being a bit slow today.

    I want to use HTML2PDF to generate a PDF on the fly with the stock details based on a specific ID.

    I have a page that generates the required HTML so that if I open the URL html_generator.php?stockID=1 I get the HTML code that would be required to generate the PDF.

    Problem I'm having is getting that stockID into play with a second page pdf_generator.php which passes the html to the html2pdf class and outputs the PDF.

    If I use $html=file_get_content(html_generator.php?stockID=1) it looks for that exact URL rather than seeing the get part separately. Same problem if I include that URL.

    If call pdf_generator.php?stockID=1 and try to assign $id=$_GET['stockID'], I get an error message relating to headers already being set.

    If anyone has any ideas for finding a solution to this, it would be very much appreciated.

    Thanks in advance.

  2. #2
    SitePoint Wizard lorenw's Avatar
    Join Date
    Feb 2005
    was rainy Oregon now sunny Florida
    2 Post(s)
    0 Thread(s)
    The error that headers have been sent means that something was sent to the browser before the PDF header was sent.

    This could be a space or line feed before the PHP tags.
    Don't echo out anything and let the PDF header be the first thing sent to the browser.
    What I lack in acuracy I make up for in misteaks


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts