문제

Hi i am using tcpdf in my application and i have two question about that.I am able to get pdf output of a html page when i click specified button. My first question is:How can i download that html's pdf output when i click that button?($pdf->lastPage() didn'work). My second question is:How can i set character encoding for Trkish?(I am using dejavusans but some turkish characters appears as question mark)

Thank for advance...

도움이 되었습니까?

해결책

for the output you should take a look at the examples: http://www.tecnick.com/public/code/cp_dpage.php?aiocp_dp=tcpdf_examples

I would not recommend to set the character encoding to turkish. I recommend using utf8 instead. (dejavusans is not an encoding it as a font)

<?php
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// create your PDF
$pdf->Output(); // This will Output the PDF to the Browser if a Plugin is installed or download the PDF file if not

다른 팁

You have to create the form for button then post that form on submit button..see the below code.

<br>
<?php<br>
if($_POST['download'])<br>
{<br>
$strPdfName = “Myfile”; <br>
<br>
include(“pdf/tcpdf.php”); <br>
<pre>
$strHtml='write here html';
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, ‘UTF-8′, false); <br>

$pdf->setPrintHeader(false); <br>

$pdf->AddPage(); <br>

$pdf->SetFont(‘helvetica’, ”, 9); <br>

$pdf->writeHTML($strHtml, true, 0, true, 0); <br>

$pdf->lastPage();<br>

$pdf->Output($strPdfName, ‘D’);<br>

}<br>
?>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top