PHPでPDF出力(tcpdf) 画像取込

TCPDF定義ファイルに画像を取込みPDF出力

TCPDF定義ファイルジェネレーターにExcleの画像取込み機能を追加した。

因みに、動作するにはGDライブラリが必須になる。

 

帳票設計したExcelファイル

f:id:sesjk:20200903145259p:plain

   

出力PDFはこちらから 納品書

 TCPDF定義ファイル

<?php

/***********************************************************************

*

* lxsTCPDFで作成したソースです。ソースの内容には責任を負いかねます

* 改変は自由です。

* クラス名は変更しないでください

***********************************************************************/

?>

<?php

Class tcpDefine extends tcpdfEditer {

 

public function setHeader() {

//ヘッダー・フッター印刷しない

$this->setPrintHeader(false);

 

$this->setPrintFooter(0);

$this->setHeaderMargin(0);

$this->setFooterMargin(0);

//余白

$this->SetMargins(7.8,8.7,-1,true);

 

}

 

public function newPage() {

//ページ追加

$this->AddPage('L','A4');

 

}

 

public function setPage($pnum, $resetmargins = false) {

//自動改ページ オフ

$this->SetAutoPageBreak(False, 0);

 

$a = $this->GetX();

$b = $this->GetY();

$wd=41;

$vPos=8.7;

$hPos=132.4;

$this->SetFont('kozminproregular', '',20);

$this->SetTextColor(79,129,189);

$source ='納 品 書';

$pos = $vPos;

$this->SetXY($hPos, $pos);

$this->Cell($wd,11, $source, 0, 0,'C',0,'',0,0,'T','M');

$wd=14;

$vPos=8.7;

$hPos=202.5;

$this->SetFont('kozminproregular', '',11);

$this->SetTextColor(0,0,0);

$source ='納品No';

$pos = $vPos;

$this->SetXY($hPos, $pos);

$this->Cell($wd,6, $source, 0, 0,'L',0,'',0,0,'T','M');

$wd=11;

$vPos=8.7;

$hPos=216.8;

$source =$this->_pdf_vars['No'];

$pos = $vPos;

$this->SetXY($hPos, $pos);

$this->Cell($wd,6, $source, 0, 0,'L',0,'',0,0,'T','M');

$wd=14;

$vPos=14.4;

$hPos=202.5;

$source ='納品日';

$pos = $vPos;

$this->SetXY($hPos, $pos);

$this->Cell($wd,5, $source, 0, 0,'L',0,'',0,0,'T','M');

$wd=29;

$vPos=14.4;

$hPos=216.8;

$source =$this->_pdf_vars['nouhinbi'];

$pos = $vPos;

$this->SetXY($hPos, $pos);

$this->Cell($wd,5, $source, 0, 0,'L',0,'',0,0,'T','M');

$wd=88;

$vPos=19.3;

$hPos=19.3;

$this->SetFont('kozminproregular', '',14);

$source =$this->_pdf_vars['name'];

$pos = $vPos;

$this->SetXY($hPos, $pos);

$this->Cell($wd,9, $source, 0, 0,'L',0,'',0,0,'T','M');

$wd=14;

$vPos=19.3;

$hPos=107.3;

$source =$this->_pdf_vars['keisyo'];

$pos = $vPos;

$this->SetXY($hPos, $pos);

$this->Cell($wd,9, $source, 0, 0,'L',0,'',0,0,'T','M');

$wd=11;

$vPos=23.2;

$hPos=173.6;

$this->SetFont('kozminproregular', '',12);

$this->SetTextColor(0,112,192);

$source ='株式会社システム・エッセンス';

$pos = $vPos;

$this->SetXY($hPos, $pos);

$this->Cell($wd,5, $source, 0, 0,'L',0,'',0,0,'T','M');

$wd=22;

$vPos=31;

$hPos=19.3;

$this->SetFont('kozminproregular', '',11);

$this->SetTextColor(0,0,0);

$source =$this->_pdf_vars['zip'];

$pos = $vPos;

$this->SetXY($hPos, $pos);

$this->Cell($wd,5, $source, 0, 0,'L',0,'',0,0,'T','M');

$wd=73;

$vPos=31;

$hPos=173.6;

$this->SetFont('kozminproregular', '',11);

$this->SetTextColor(0,112,192);

$source ='184-0003 東京都小金井市○○町1-1-1';

$pos = $vPos;

$this->SetXY($hPos, $pos);

$this->Cell($wd,5, $source, 0, 0,'L',0,'',0,0,'T','M');

$wd=102;

$vPos=36.2;

$hPos=19.3;

$this->SetTextColor(0,0,0);

$source =$this->_pdf_vars['addr'];

$pos = $vPos;

$this->SetXY($hPos, $pos);

$this->Cell($wd,5, $source, 0, 0,'L',0,'',0,0,'T','M');

$wd=11;

$vPos=36.2;

$hPos=173.6;

$this->SetTextColor(0,112,192);

$source ='TEL042-380-xxxx FAX 042-380-xxxx';

$pos = $vPos;

$this->SetXY($hPos, $pos);

$this->Cell($wd,5, $source, 0, 0,'L',0,'',0,0,'T','M');

$wd=11;

$vPos=40.9;

$hPos=19.3;

$this->SetTextColor(0,0,0);

$source =$this->_pdf_vars['bill'];

$pos = $vPos;

$this->SetXY($hPos, $pos);

$this->Cell($wd,5, $source, 0, 0,'L',0,'',0,0,'T','M');

$this->Rect(19.3, 55.2,66,6,'F','',array(83,141,213));

$wd=66;

$vPos=55.2;

$hPos=19.3;

$this->SetTextColor(255,255,255);

$source ='品番/品名';

$pos = $vPos;

$this->SetXY($hPos, $pos);

$this->Cell($wd,6, $source, 0, 0,'C',0,'',0,0,'T','M');

$this->Rect(85.3, 55.2,22,6,'F','',array(83,141,213));

$wd=22;

$vPos=55.2;

$hPos=85.3;

$source ='数量';

$pos = $vPos;

$this->SetXY($hPos, $pos);

$this->Cell($wd,6, $source, 0, 0,'C',0,'',0,0,'T','M');

$this->Rect(107.3, 55.2,14,6,'F','',array(83,141,213));

$wd=14;

$vPos=55.2;

$hPos=107.3;

$source ='単位';

$pos = $vPos;

$this->SetXY($hPos, $pos);

$this->Cell($wd,6, $source, 0, 0,'C',0,'',0,0,'T','M');

$this->Rect(121.4, 55.2,30,6,'F','',array(83,141,213));

$wd=30;

$vPos=55.2;

$hPos=121.4;

$source ='単  価';

$pos = $vPos;

$this->SetXY($hPos, $pos);

$this->Cell($wd,6, $source, 0, 0,'C',0,'',0,0,'T','M');

$this->Rect(151.6, 55.2,33,6,'F','',array(83,141,213));

$wd=33;

$vPos=55.2;

$hPos=151.6;

$source ='金  額';

$pos = $vPos;

$this->SetXY($hPos, $pos);

$this->Cell($wd,6, $source, 0, 0,'C',0,'',0,0,'T','M');

$this->Rect(184.6, 55.2,62,6,'F','',array(83,141,213));

$wd=62;

$vPos=55.2;

$hPos=184.6;

$source ='摘   要';

$pos = $vPos;

$this->SetXY($hPos, $pos);

$this->Cell($wd,6, $source, 0, 0,'C',0,'',0,0,'T','M');

$wd=66;

 

// 行の高さ

$hi = 8.2;

// 行の開始位置

$vPos = 61.6;

$row = 12;

$iy = 0;

$maxRow = 18;

foreach ($this->_pdf_vars['loop'] as $key) {

$iy++;

$hPos=19.3;

$wd = 66;

//背景色

if (($iy % 2) == 0 ) {

$this->Rect($hPos, $vPos,$wd, $hi,'F','',array(220,230,241));

}

 

$this->SetTextColor(0,0,0);

if (isset( $key['hinmei'] ) ) {

$source = $key['hinmei'];

} else {

$source = '';

}

$this->SetXY($hPos, $vPos);

$info = $this->adjustToWidth($source, $wd,'kozminproregular',11);

$this->SetFont('kozminproregular', '',$info);

$this->Cell( $wd, $hi, $source, 0, 0,'L',0,'',0,0,'T','M');

$hPos=85.3;

$wd = 22;

//背景色

if (($iy % 2) == 0 ) {

$this->Rect($hPos, $vPos,$wd, $hi,'F','',array(220,230,241));

}

 

$this->SetTextColor(0,0,0);

if (isset( $key['suryo'] ) ) {

$source = $key['suryo'];

} else {

$source = '';

}

$this->SetXY($hPos, $vPos);

$this->Cell( $wd, $hi, $source, 0, 0,'R',0,'',0,0,'T','M');

$hPos=107.3;

$wd = 14;

//背景色

if (($iy % 2) == 0 ) {

$this->Rect($hPos, $vPos,$wd, $hi,'F','',array(220,230,241));

}

 

$this->SetTextColor(0,0,0);

if (isset( $key['tani'] ) ) {

$source = $key['tani'];

} else {

$source = '';

}

$this->SetXY($hPos, $vPos);

$this->Cell( $wd, $hi, $source, 0, 0,'C',0,'',0,0,'T','M');

$hPos=121.4;

$wd = 30;

//背景色

if (($iy % 2) == 0 ) {

$this->Rect($hPos, $vPos,$wd, $hi,'F','',array(220,230,241));

}

 

$this->SetTextColor(0,0,0);

if (isset( $key['tanka'] ) ) {

$source = $key['tanka'];

} else {

$source = '';

}

$this->SetXY($hPos, $vPos);

$this->Cell( $wd, $hi, $source, 0, 0,'R',0,'',0,0,'T','M');

$hPos=151.6;

$wd = 33;

//背景色

if (($iy % 2) == 0 ) {

$this->Rect($hPos, $vPos,$wd, $hi,'F','',array(220,230,241));

}

 

$this->SetTextColor(0,0,0);

if (isset( $key['kingaku'] ) ) {

$source = $key['kingaku'];

} else {

$source = '';

}

$this->SetXY($hPos, $vPos);

$this->Cell( $wd, $hi, $source, 0, 0,'R',0,'',0,0,'T','M');

$hPos=184.6;

$wd = 62;

//背景色

if (($iy % 2) == 0 ) {

$this->Rect($hPos, $vPos,$wd, $hi,'F','',array(220,230,241));

}

 

$this->SetTextColor(0,0,0);

if (isset( $key['bikou'] ) ) {

$source = $key['bikou'];

} else {

$source = '';

}

$pos=$vPos;

$this->SetFont('kozminproregular', '',11);

$chrcnt=0;

for ($k= 0; $k != -1; ) {

$info = $this->adjustToHeight($source, $k,$wd, $wd - 1,8.2,'kozminproregular',11,$chrcnt);

$k = $info['length'];

$text = $info['text'];

$this->SetXY($hPos, $pos);

$this->Cell($wd, $info['height'], $text, 0, 0,'L',0,'',0,0,'T','M');

$pos += $info['height'];

$chrcnt = $info['count'];

}

$vPos += $hi;

$row++;

}

 

$hPos=19.3;

$wd = 227;

$lastRow = 18;

for($row = $row; $row <= $lastRow;$row++) {

$iy++;

if (($iy % 2) == 0 ) {

$this->Rect($hPos, $vPos,$wd, $hi,'F','',array(220,230,241));

}

$vPos += $hi;

}

$this->Rect(121.4, 119,30,6,'F','',array(220,230,241));

$wd=30;

$vPos=119;

$hPos=121.4;

$this->SetTextColor(0,0,0);

$source ='小計(税抜)';

$pos = $vPos;

$this->SetXY($hPos, $pos);

$this->Cell($wd,6, $source, 0, 0,'C',0,'',0,0,'T','M');

$wd=33;

$vPos=119;

$hPos=151.6;

$source =$this->_pdf_vars['syoukei'];

$pos = $vPos;

$this->SetXY($hPos, $pos);

$this->Cell($wd,6, $source, 0, 0,'R',0,'',0,0,'T','M');

$this->Rect(121.4, 125.4,30,6,'F','',array(220,230,241));

$wd=30;

$vPos=125.4;

$hPos=121.4;

$source ='消費税';

$pos = $vPos;

$this->SetXY($hPos, $pos);

$this->Cell($wd,6, $source, 0, 0,'C',0,'',0,0,'T','M');

$wd=33;

$vPos=125.4;

$hPos=151.6;

$source =$this->_pdf_vars['zei'];

$pos = $vPos;

$this->SetXY($hPos, $pos);

$this->Cell($wd,6, $source, 0, 0,'R',0,'',0,0,'T','M');

$this->Rect(121.4, 131.8,30,7,'F','',array(220,230,241));

$wd=30;

$vPos=131.8;

$hPos=121.4;

$source ='合計金額';

$pos = $vPos;

$this->SetXY($hPos, $pos);

$this->Cell($wd,7, $source, 0, 0,'C',0,'',0,0,'T','M');

$wd=33;

$vPos=131.8;

$hPos=151.6;

$source =$this->_pdf_vars['total'];

$pos = $vPos;

$this->SetXY($hPos, $pos);

$this->Cell($wd,7, $source, 0, 0,'R',0,'',0,0,'T','M');

 

//罫線設定

$this->Line(19.3, 55.2, 85.3, 55.2, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(85.3, 55.2, 85.3, 61.6, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(149,179,215)));

$this->Line(85.3, 55.2, 107.3, 55.2, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(107.3, 55.2, 107.3, 61.6, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(149,179,215)));

$this->Line(107.3, 55.2, 121.4, 55.2, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(121.4, 55.2, 121.4, 61.6, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(149,179,215)));

$this->Line(121.4, 55.2, 151.6, 55.2, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(151.6, 55.2, 151.6, 61.6, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(149,179,215)));

$this->Line(151.6, 55.2, 184.6, 55.2, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(184.6, 55.2, 184.6, 61.6, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(149,179,215)));

$this->Line(184.6, 55.2, 246.2, 55.2, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(246.2, 55.2, 246.2, 61.6, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(19.3, 61.6, 85.3, 61.6, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(85.3, 61.6, 85.3, 69.8, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(85.3, 61.6, 107.3, 61.6, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(107.3, 61.6, 107.3, 69.8, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(107.3, 61.6, 121.4, 61.6, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(121.4, 61.6, 121.4, 69.8, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(121.4, 61.6, 151.6, 61.6, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(151.6, 61.6, 151.6, 69.8, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(151.6, 61.6, 184.6, 61.6, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(184.6, 61.6, 184.6, 69.8, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(184.6, 61.6, 246.2, 61.6, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(246.2, 61.6, 246.2, 69.8, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(19.3, 69.8, 85.3, 69.8, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(85.3, 69.8, 85.3, 78, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(85.3, 69.8, 107.3, 69.8, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(107.3, 69.8, 107.3, 78, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(107.3, 69.8, 121.4, 69.8, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(121.4, 69.8, 121.4, 78, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(121.4, 69.8, 151.6, 69.8, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(151.6, 69.8, 151.6, 78, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(151.6, 69.8, 184.6, 69.8, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(184.6, 69.8, 184.6, 78, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(184.6, 69.8, 246.2, 69.8, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(246.2, 69.8, 246.2, 78, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(19.3, 78, 85.3, 78, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(85.3, 78, 85.3, 86.2, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(85.3, 78, 107.3, 78, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(107.3, 78, 107.3, 86.2, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(107.3, 78, 121.4, 78, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(121.4, 78, 121.4, 86.2, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(121.4, 78, 151.6, 78, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(151.6, 78, 151.6, 86.2, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(151.6, 78, 184.6, 78, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(184.6, 78, 184.6, 86.2, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(184.6, 78, 246.2, 78, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(246.2, 78, 246.2, 86.2, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(19.3, 86.2, 85.3, 86.2, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(85.3, 86.2, 85.3, 94.4, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(85.3, 86.2, 107.3, 86.2, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(107.3, 86.2, 107.3, 94.4, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(107.3, 86.2, 121.4, 86.2, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(121.4, 86.2, 121.4, 94.4, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(121.4, 86.2, 151.6, 86.2, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(151.6, 86.2, 151.6, 94.4, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(151.6, 86.2, 184.6, 86.2, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(184.6, 86.2, 184.6, 94.4, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(184.6, 86.2, 246.2, 86.2, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(246.2, 86.2, 246.2, 94.4, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(19.3, 94.4, 85.3, 94.4, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(85.3, 94.4, 85.3, 102.6, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(85.3, 94.4, 107.3, 94.4, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(107.3, 94.4, 107.3, 102.6, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(107.3, 94.4, 121.4, 94.4, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(121.4, 94.4, 121.4, 102.6, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(121.4, 94.4, 151.6, 94.4, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(151.6, 94.4, 151.6, 102.6, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(151.6, 94.4, 184.6, 94.4, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(184.6, 94.4, 184.6, 102.6, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(184.6, 94.4, 246.2, 94.4, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(246.2, 94.4, 246.2, 102.6, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(19.3, 102.6, 85.3, 102.6, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(85.3, 102.6, 85.3, 110.8, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(85.3, 102.6, 107.3, 102.6, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(107.3, 102.6, 107.3, 110.8, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(107.3, 102.6, 121.4, 102.6, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(121.4, 102.6, 121.4, 110.8, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(121.4, 102.6, 151.6, 102.6, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(151.6, 102.6, 151.6, 110.8, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(151.6, 102.6, 184.6, 102.6, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(184.6, 102.6, 184.6, 110.8, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(184.6, 102.6, 246.2, 102.6, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(246.2, 102.6, 246.2, 110.8, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(19.3, 110.8, 85.3, 110.8, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(85.3, 110.8, 85.3, 119, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(85.3, 110.8, 107.3, 110.8, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(107.3, 110.8, 107.3, 119, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(107.3, 110.8, 121.4, 110.8, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(121.4, 110.8, 121.4, 119, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(121.4, 110.8, 151.6, 110.8, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(151.6, 110.8, 151.6, 119, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(151.6, 110.8, 184.6, 110.8, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(184.6, 110.8, 184.6, 119, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(184.6, 110.8, 246.2, 110.8, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(246.2, 110.8, 246.2, 119, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(19.3, 55.2, 19.3, 119, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(19.3, 119, 121.4, 119, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(121.4, 119, 151.6, 119, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(151.6, 119, 151.6, 125.4, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(151.6, 119, 184.6, 119, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(184.6, 119, 184.6, 125.4, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(184.6, 119, 246.2, 119, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(121.4, 125.4, 151.6, 125.4, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 1, 'color' => array(83,141,213)));

$this->Line(151.6, 125.4, 151.6, 131.8, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(151.6, 125.4, 184.6, 125.4, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 1, 'color' => array(83,141,213)));

$this->Line(184.6, 125.4, 184.6, 131.8, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(121.4, 131.8, 151.6, 131.8, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 1, 'color' => array(83,141,213)));

$this->Line(151.6, 131.8, 151.6, 138.5, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(151.6, 131.8, 184.6, 131.8, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 1, 'color' => array(83,141,213)));

$this->Line(184.6, 131.8, 184.6, 138.5, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(121.4, 119, 121.4, 138.5, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

$this->Line(121.4, 138.5, 184.6, 138.5, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(83,141,213)));

//画像情報

$this->Image('pdf_images/Picture1.png',220,20.2,23.4,24.7);

}

}

 

?>

 

index.phpファイル

<?php

error_reporting(E_ALL & ~ E_DEPRECATED & ~ E_USER_DEPRECATED & ~ E_NOTICE);

ini_set('display_errors', 1);

    require_once(dirname(__FILE__)."/../lib/TCPDF-master/tcpdf.php");

 

    require_once(dirname(__FILE__)."/tcpdfEditer.php");

 

    require_once(dirname(__FILE__)."/nouhinsyo.php");

 

    $pdf = new tcpDefine();

 

    $pdf->assign('zip', "184-0003");

    $pdf->assign('addr', "小金井市□□町1−1−1");

    $pdf->assign('bill', "駅前ビル301");

    $pdf->assign('name', "ジェーケイソフト");

    $pdf->assign('keisyo', "御中");

    $pdf->assign('nouhinbi', "2020年8月20日");

    $pdf->assign('No', "1-0115");

 

    $lpdata= array();

    $lpdata = array('hinmei'=>'パソコン','suryo'=>'2','tani'=>'台','tanka'=>'70,000','kingaku'=>'140,000','bikou'=>'');

    $pdf->append('loop', $lpdata);

    $lpdata = array('hinmei'=>'モニター','suryo'=>'2','tani'=>'台','tanka'=>'25,000','kingaku'=>'50,000','bikou'=>'');

    $pdf->append('loop', $lpdata);

    $lpdata = array('hinmei'=>'プリンター','suryo'=>'1','tani'=>'台','tanka'=>'55,000','kingaku'=>'55,000','bikou'=>'別納');

    $pdf->append('loop', $lpdata);

    $pdf->assign('syoukei','245,000');

    $pdf->assign('total', "269,500");

    $pdf->assign('zei', "24,500");

 

 

//    $pdf->init("hakenn");

 

$pdf->setHeader();

$pdf->newPage();

 

    $pdf->out('nouhin.pdf', 'I');

 

 

?>