0
我需要你的幫助或來自輸出文件pdf與jQuery的建議。我有輸出文件的問題,因爲pdf文件沒有出來。這個腳本jQuery和HTML:用Jquery輸出文件PDF
<script>
$("#msg").hide();
$("button").click(function() {
var subject = $("#subject").val();
var client = $("#client").val();
$.ajax ({
url: "http://localhost/report/fpdf_report.php",
type: "POST",
data: { subject: subject, client: client },
success: function(data) {
$("#msg").html(data);
$("#msg").fadeIn("slow").delay(2000);
},
error: function(xhr) {
alert(xhr+"error");
}
});
});
</script>
<input type="text" id="subject" /> <input type="text" id="client" /> <input type="text" id="client" /> <button>PDF</button> <br /> <div id="msg"></div>
所以對於PHP腳本轉換PDF:
<?php
$subject = $_POST['subject'];
$client = $_POST['client'];
require ('fpdf/fpdf.php');
$pdf = new FPDF();
$pdf -> AddPage();
$pdf -> SetFont('Arial','B',20);
$pdf -> Cell(40,10,$subject);
$pdf -> Cell(50,20,$client);
$pdf -> Output();
?>
親愛的Tenhsor,感謝您的幫助:D – akashi 2014-10-09 13:05:11