|
-
Jan 31st, 2007, 02:54 AM
#1
Thread Starter
Lively Member
Converting html to pdf
Hi All
I am trying to convert a html form into pdf using php code.
I have a page where is a text like download form as pdf and linked it with a file say "contactform.php"
when user clicks on the link a form in pdf form should should open.
I have wrtitten the code for the same in the contactform.php
here is my code
//
<? session_start(); ?>
<? include("includes/conninc.php"); ?>
<? if(isset($_GET['p'])){$p=$_GET['p'];}else{$p="flatfee";} ?>
<? if($p=="assist"){$contract="seller_program_web.php";}else{$contract="seller_fee_web.php";} ?>
<? require 'PDF.php';
$pdf = &PDF::factory('p', 'a4');
$pdf->open();
$pdf->setCompression(true);
$pdf->addPage();
$pdf->setFont('Courier', '', 8);
$pdf->text(100, 100, 'Resume');
$pdf->setFontSize(10);
$str="
<html>
<body>
<table width="760" align="center" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="259"><img src="images/a-1.jpg" width="259" height="93"></td>
<td width="232"><img src="images/a-2.jpg" width="232" height="93"></td>
<td width="288"><img src="images/a-3.jpg" width="269" height="93"></td>
</tr>
<tr>
<td colspan="3" bgcolor=""#FFFFFF"">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor=""#FEBC21"" height="100" valign="top">
include("includes/menu.php")
</td>
<td width="80%" rowspan="2" valign="top">
<table width="97%" height="100%" bgcolor=""#FFFFFF"" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td><BR>
<h3 style=""color:#FFBD20"">Commercial Property Form</h3>
<p><img border="0" src="images/required_fields.gif" width="139" height="20" /></p>
<form name="ListingForm" method="POST" action=""<?=$contract?>"" onSubmit="return CheckForm(this);">
<input type="hidden" name="Form_Type" value="Commercial Property Form">
<table id="formTable" cellpadding="3" cellspacing="0" width="100%">
<tr>
<td width="50%" align="right" style=""color: #567890; font-size:13px;"">Full Name:</td>
<td width="50%"><input name="reqFull_Name" type="text" id="Full_Name" value="" maxlength="100" /><img border="0" src="images/required.gif" width="20" height="20" /></td>
</tr>
<tr>
<td align="right" style=""color: #567890; font-size:13px;"">Email:</td>
<td><input name="reqEmail" type="text" id="Email" value="" maxlength="100" /><img border="0" src="images/required.gif" width="20" height="20" /></td>
</tr>
<tr>
<td align="right" style=""color: #567890; font-size:13px;"">Phone:</td>
<td><input name="reqPhone" type="text" id="Phone" value="" maxlength="100" /><img border="0" src="images/required.gif" width="20" height="20" /></td>
</tr>
</table>
</table>";
$pdf->text(100, 200,$str);
$pdf->addPage();
$pdf->setFont('Arial', 'BI', 12);
$pdf->text(100, 100, 'Second page');
$pdf->output('listing_commercial.pdf');
//
but when i click on the link blank page is opening .
Please help me to solve whats wrong in my code.
If any other option to do the same then also please suggest.
Thanks
Seema
-
Jan 31st, 2007, 03:28 AM
#2
Re: Converting html to pdf
considering you didn't even escape any of the quotes in your thing, no wonder it's not working.
escape your quotes (using the backslash ("\")), then come with back with a real question :/
you also have invalid HTML, because you have triple quotes for some parameters (for example, I saw a bunch of things like: parameter=""value". this is invalid syntax)
-
Jan 31st, 2007, 06:56 AM
#3
Thread Starter
Lively Member
Re: Converting html to pdf
Hi
Thanks for the reply.
I have remove the " where is was double.
after that also the same problem.
Is there any other way to do the same?
-
Jan 31st, 2007, 10:26 AM
#4
Re: Converting html to pdf
if you still haven't escaped your quotes, you're going to have the same problem.
-
Jan 31st, 2007, 06:31 PM
#5
Hyperactive Member
Re: Converting html to pdf
 Originally Posted by simi28
Hi
Thanks for the reply.
I have remove the " where is was double.
after that also the same problem.
Is there any other way to do the same?
read
http://us2.php.net/types.string
PHP Code:
<?php
echo 'this is a simple string';
echo 'You can also have embedded newlines in
strings this way as it is
okay to do';
// Outputs: Arnold once said: "I'll be back"
echo 'Arnold once said: "I\'ll be back"';
// Outputs: You deleted C:\*.*?
echo 'You deleted C:\\*.*?';
// Outputs: You deleted C:\*.*?
echo 'You deleted C:\*.*?';
// Outputs: This will not expand: \n a newline
echo 'This will not expand: \n a newline';
// Outputs: Variables do not $expand $either
echo 'Variables do not $expand $either';
?>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|