hi,

i created this code a long time ago and during that time i had all the info i needed to do a save as PDF but now its all gone and the client wants that option so no one can change it.

code below:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>

	<meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />
	
	<title>Invoice</title>
	
	<link rel='stylesheet' type='text/css' href='css/style.css' />
	<link rel='stylesheet' type='text/css' href='css/print.css' media="print" />
	<script type='text/javascript' src='js/jquery-1.3.2.min.js'></script>
	<script type='text/javascript' src='js/example.js'></script>

</head>

<body>

	<div id="page-wrap">

		<textarea id="header">INVOICE</textarea>
		
		<div id="identity">
		
            <textarea id="address">Company Address</textarea>

            <div id="logo">

              <div id="logoctr">
                <a href="javascript:;" id="change-logo" title="Change logo">Change Logo</a>
                <a href="javascript:;" id="save-logo" title="Save changes">Save</a>
                |
                <a href="javascript:;" id="delete-logo" title="Delete logo">Delete Logo</a>
                <a href="javascript:;" id="cancel-logo" title="Cancel changes">Cancel</a>
              </div>

              <div id="logohelp">
                <input id="imageloc" type="text" size="50" value="" /><br />
                (max width: 540px, max height: 100px)
              </div>
              <img id="image" src="images/logo.png" alt="logo" />
            </div>
		
		</div>
		
		<div style="clear:both"></div>
		
		<div id="customer">

            <textarea id="customer-title">Client details
go here</textarea>

            <table id="meta">
                <tr>
                    <td class="meta-head">Invoice #</td>
                    <td><textarea>000123</textarea></td>
                </tr>
                <tr>

                    <td class="meta-head">Date</td>
                    <td><textarea id="date">December 15, 2009</textarea></td>
                </tr>
                <tr>
                    <td class="meta-head">Amount Due</td>
                    <td><div class="due">£875.00</div></td>
                </tr>

            </table>
		
		</div>
		
		<table id="items">
		
		  <tr>
		      <th>Item</th>
		      <th>Description</th>
		      <th>Unit Cost</th>
		      <th>Quantity</th>
		      <th>Price</th>
		  </tr>
		  
		  <tr class="item-row">
		      <td class="item-name"><div class="delete-wpr"><textarea>Pickup</textarea><a class="delete" href="javascript:;" title="Remove row">X</a></div></td>
		      <td class="description"><textarea>Type here</textarea></td>
		      <td><textarea class="cost">£650.00</textarea></td>
		      <td><textarea class="qty">1</textarea></td>
		      <td><span class="price">£650.00</span></td>
		  </tr>
		  
		  <tr class="item-row">
		      <td class="item-name"><div class="delete-wpr"><textarea>Destination</textarea><a class="delete" href="javascript:;" title="Remove row">X</a></div></td>

		      <td class="description"><textarea>Type Here</textarea></td>
		      <td><textarea class="cost">£75.00</textarea></td>
		      <td><textarea class="qty">1</textarea></td>
		      <td><span class="price">£225.00</span></td>
		  </tr>

		  <tr class="item-row">
		      <td class="item-name"><div class="delete-wpr"><textarea>Waiting Time</textarea><a class="delete" href="javascript:;" title="Remove row">X</a></div></td>

		      <td class="description"><textarea>Type Here</textarea></td>
		      <td><textarea class="cost">£75.00</textarea></td>
		      <td><textarea class="qty">1</textarea></td>
		      <td><span class="price">£225.00</span></td>
		  </tr>
		  
		  <tr id="hiderow">
		    <td colspan="5"><a id="addrow" href="javascript:;" title="Add a row">Add a row</a></td>
		  </tr>
		  
		  <tr>
		      <td colspan="2" class="blank"> </td>
		      <td colspan="2" class="total-line">Subtotal</td>
		      <td class="total-value"><div id="subtotal">£875.00</div></td>
		  </tr>
		  <tr>

		      <td colspan="2" class="blank"> </td>
		      <td colspan="2" class="total-line">Total</td>
		      <td class="total-value"><div id="total">£875.00</div></td>
		  </tr>
		  <tr>
		      <td colspan="2" class="blank"> </td>
		      <td colspan="2" class="total-line">Amount Paid</td>

		      <td class="total-value"><textarea id="paid">£0.00</textarea></td>
		  </tr>
		  <tr>
		      <td colspan="2" class="blank"> </td>
		      <td colspan="2" class="total-line balance">Balance Due</td>
		      <td class="total-value balance"><div class="due">£875.00</div></td>
		  </tr>
		
		</table>
		
		<div id="terms">
		  <h5>Terms</h5>
		  <textarea>NET 30 Days. Finance Charge of 1.5% will be made on unpaid balances after 30 days.</textarea>
		</div>
	
	</div>


</body>

</html>

can anyone help to put a button on the bottom of the page to Save to PDF so they can email it electronically or even send it via the page itself.

i have looked at other forums, that suggested htmltopdf etc but i couldnt adapt it to the website as i would have intended it to be.

any help is greatfully appreciated.

thanks

Recommended Answers

All 8 Replies

What you have shown is a static HTML form. Is this just sample output? If so, then what you need to post is the program that generated it? If not, why would you want a PDF of this page?

there wasnt a program that generated it, i took some code from the internet and adapted as first the client wanted a form that generated a mathmatic answer which i created but then they changed their mind in the whole process. the code above is something they want to turn into PDF at the click of a button, i did question it before that it might not be possible from the same page but anything you can help with will be helpfull.

apologies, its not an output but as mentioned a mathmatic answer with invoice type page. this is what the user see's but they want to make it into pdf to send to people.

Probably the easiest solution to create a PDF is to display it in the browser and "print" it to a PDF on the local disk using a utility like CutePDF. It could then be attached to an email.

If they really want to be able to email a copy with a click of a button, then you need to make this a PHP file. You can use ob_start and ob_get_contents to capture the form to a variable. You then feed that variable into HTML2PDF and produce the PDF file. You can see sample code for HTML2PF here. You can then email the form as an attachment. See my help item on emailing (with attachments) if you need help with that.

This is a php page, that was an option and along with others but they want to be able to do it from anywhere internal and external to the company. Can this php have an option to save pdf?

If you are planning on creating the PDF files on your end, you can always check out this code to see if it is what you need for your site application.

<input type="button" onClick="window.print()" value="Print">
this ll give u the pdf format

Member Avatar for diafol

You revived a dead thread with that? Check your facts.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.