Jump to content

Convert PHP Web Page with Table Entries to PDF for Print


n1concepts

Recommended Posts

Hi,

 

I need a way to convert a php file (including example of belowtable) as PDF for print.

 

Reason: we need to print content to a specific width & height - labels for specific printer paper - and when printing the web page (itself), the URL, title, etc... is included b/c of the default browser settings. Note: this is a problem b/c multiple locations will use the same web form so I need to convert that page's content (a table with dynamically entered data) to PDF to have that "pdf" form printed which will hold the exact specs of that file.

 

Can someone advise code require to capture the below page content to print as PDF?

Below is an example of the actual web page - I used static text instead of dynamic variable to show content in output.

 

<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Labels for Print</title>
<link href="styles/style.css" rel="stylesheet" type="text/css" media="screen">
</head>

<body>

<table border="1" align="center" cellpadding="5" cellspacing="5">
  <tr>
    <td class="size">
    <div class="pname">Product1 Name</div>
    <ul>
<li>Product1 Feature One</li>
<li>Product1 Feature Two</li>
        <li>Product1 Feature Three</li></ul>
    <div class="price">$110.99</div>
    </td>

<td class="size">
    <div class="pname">Product2 Name</div>
    <ul>
<li>Product2 Feature One</li>
<li>Product2 Feature Two</li>
        <li>Product2 Feature Three</li></ul>
    <div class="price">$130.99</div>
    </td>
  </tr>

    <td class="size">
    <div class="pname">Product3 Name</div>
    <ul>
<li>Product3 Feature One</li>
<li>Product3 Feature Two</li>
        <li>Product3 Feature Three</li></ul>
    <div class="price">$130.99</div>
    </td>
  </tr>

</table>

</body>
</html>

 

------

 

I found http://fpdf.org but it only gives basic tutorials - I need to figure out how to capture the above data (which is actually $_SESSIONS; Again, I inserted static text for this example) to print as PDF via Firefox (only); IE will not be used....

 

Any support defining this code surely appreciated....

Link to comment
Share on other sites

Yeah, Fpdf appears to be the best choice - at least more structured than the others I've viewed - but I'm having some issues getting the table & css aligned the way I need to handle the data positioning for print.

 

I'll continue to play w/it - will figure it out eventually.

Note: will post resolution once found.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.