前提・実現したいこと
PHPでformの内容をデータベースに入れてその内容をPDFに差し込むコードを作っています。
その前段階でformの値をそのままpdf表示できたらと思います。
しかしFPDFを実装中に以下のエラーが発生しました。
発生している問題
index.htmlの値がhtmlのコードで表示されてしまう。
該当のソースコード
php
<?php require('tfpdf.php'); $pdf = new tFPDF(); $pdf->AddPage(); // Add a Unicode font (uses UTF-8) $pdf->AddFont('DejaVu','','DejaVuSansCondensed.ttf',true); $pdf->SetFont('DejaVu','',14); // Load a UTF-8 string from a file and print it $txt = file_get_contents('index.html'); $pdf->Write(8,$txt); // Select a standard font (uses windows-1252) $pdf->SetFont('Arial','',14); $pdf->Ln(10); $pdf->Write(5,'The file size of this PDF is only 13 KB.'); $pdf->Output(); ?>