问题
I am using html2pdf sucessfully created pdf, then I want to save pdf with different name based on the textbox value.
<?php
$diff_name=$_POST['name'];
$html2pdf = new HTML2PDF('P', 'A4', 'fr');
$html2pdf->pdf->SetDisplayMode('fullpage');
$html2pdf->writeHTML($content, isset($_GET['vuehtml']));
// save different name
$html2pdf->Output('$diff_name.pdf', 'F');
?>
<html>
<body>
<input type="text" name="name" />
</body>
</html>
回答1:
this is so old, but maybe somebody else will need the response.
$html2pdf->pdf->setTitle('my nice browser title');
This will control the output of the browser title.
回答2:
Your HTML output is incomplete.
Try this:
<?php
$html2pdf = new HTML2PDF('P', 'A4', 'fr');
$html2pdf->pdf->SetDisplayMode('fullpage');
$html2pdf->writeHTML($content, isset($_GET['vuehtml']));
// build new name and commit
$newname=$_POST['name'].'.pdf';
$html2pdf->Output($newname, 'F');
?>
<html>
<head>
<title>Test page</title>
<head>
<body>
<form action="" method="post">
<input type="text" name="name" />
<input type="submit" value="Save" />
</form>
</body>
</html>
来源:https://stackoverflow.com/questions/9465256/pdf-created-with-html2pdf-and-how-to-save-different-name-for-pdf-document