質問編集履歴
2
$data変数追加、セミコロンとarrayの中の,を追加しました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -6,10 +6,10 @@
|
|
6
6
|
if文で何個目のデータの時は X+=10;とする。
|
7
7
|
|
8
8
|
```PHP
|
9
|
-
array(
|
9
|
+
$data = array(
|
10
|
-
array("1","氏名","電話番号","00000000")
|
10
|
+
array("1","氏名","電話番号","00000000"),
|
11
|
-
array("1","太郎","090000066666","00000000")
|
11
|
+
array("1","太郎","090000066666","00000000"),
|
12
|
-
)
|
12
|
+
);
|
13
13
|
|
14
14
|
include(dirname(__FILE__).'tcpdf/tcpdf.php');
|
15
15
|
include(dirname(__FILE__).'fpdi/fpdi.php');
|
@@ -34,7 +34,7 @@
|
|
34
34
|
// データを書き込む
|
35
35
|
$y = 93;
|
36
36
|
|
37
|
-
foreach($
|
37
|
+
foreach($data as $i => $row){
|
38
38
|
|
39
39
|
$x = 13;
|
40
40
|
|
1
コードが正常に動くように修正しました。失礼しました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -5,17 +5,32 @@
|
|
5
5
|
自分で考えたこと:
|
6
6
|
if文で何個目のデータの時は X+=10;とする。
|
7
7
|
|
8
|
-
AddPage()のif文もおかしな状態になってるコードで申し訳ありませんが、
|
9
|
-
ご教授くさい。
|
10
|
-
|
11
8
|
```PHP
|
12
9
|
array(
|
13
|
-
array(
|
10
|
+
array("1","氏名","電話番号","00000000")
|
14
|
-
array(
|
11
|
+
array("1","太郎","090000066666","00000000")
|
15
|
-
・
|
16
|
-
・
|
17
|
-
・
|
18
12
|
)
|
13
|
+
|
14
|
+
include(dirname(__FILE__).'tcpdf/tcpdf.php');
|
15
|
+
include(dirname(__FILE__).'fpdi/fpdi.php');
|
16
|
+
|
17
|
+
// AddPage 引数
|
18
|
+
$orientation = 'L';
|
19
|
+
$format = 'A4';
|
20
|
+
|
21
|
+
$pdf = new FPDI();
|
22
|
+
$pdf->SetMargins(0,0,0); // 上左右マージンの設定
|
23
|
+
$pdf->SetCellPadding(0); // セルパディングの設定
|
24
|
+
$pdf->SetAutoPageBreak(false); // 自動改ページを無効
|
25
|
+
$pdf->setPrintHeader(false); // ページヘッダ無効
|
26
|
+
$pdf->setPrintFooter(false); // ページフッタ無効
|
27
|
+
|
28
|
+
$pdf->setSourceFile('test.pdf'); // テンプレートを読み込み
|
29
|
+
$template = $pdf->importPage(1);
|
30
|
+
$pdf->AddPage($orientation, $format);
|
31
|
+
$pdf->useTemplate($template, 0, 0);
|
32
|
+
$pdf->SetFont('kozgopromedium', '', 12);
|
33
|
+
|
19
34
|
// データを書き込む
|
20
35
|
$y = 93;
|
21
36
|
|
@@ -31,9 +46,9 @@
|
|
31
46
|
}
|
32
47
|
|
33
48
|
$y += 10;
|
34
|
-
|
49
|
+
|
35
|
-
$pdf->AddPage($orientation, $format);
|
36
|
-
$pdf->useTemplate($template, 0, 0);
|
37
|
-
}
|
38
50
|
}
|
51
|
+
|
52
|
+
|
53
|
+
$pdf->Output('test.pdf','D');
|
39
54
|
```
|