4

fpdi を使用して 2 ページの PDF ファイルをインポートすると、動作します。

インポートした PDF に画像を挿入する必要がありますが、元の PDF レイアウトの下にあるため、挿入したい画像が表示されません。ちなみに、テキストを追加でき、正常に動作します。

PDFの2ページ目で同じことをするとうまくいきます。画像(jpgとpng)を見ることができます。元の pdf の 2 ページ目には、元のインポートされた pdf からのレイアウト/画像がありません。

css/html のような z-index プロパティが必要です

ソース: http://pastebin.com/45BEY7fw

4

2 に答える 2

1

テンプレートページをインポートする前にページに印刷すると、機能します。ここに私のコードがあります:

  $pdf - > AddPage();

  //draw watermark
  $pdf - > SetTextColor(215, 215, 215);
  $pdf - > SetFont('Times', '', 90);
  $pdf - > RotatedText(24.5, 234.5, $school_data['watermark'], 45);
  $pdf - > SetTextColor(0, 0, 0);

  //load template
  pdf - > setSourceFile('reports/template.pdf');
  $tplIdx = $pdf - > importPage(1);
  $pdf - > SetAutoPagebreak(false, 0);

  //use the imported page and place it at point 0,0; calculate width and height
  //automaticallay and ajust the page size to the size of the imported page
  $pdf - > useTemplate($tplIdx, 0, 0, 0, 0, false);

于 2014-11-09T19:57:28.463 に答える