PHPでPDF出力(tcpdf) 8 (実行そして課題)

8.ジェネレーターの実行そして課題

 ほぼ形は整ったので、実行してみた。

ジェネレーターで出力した定義ソースと実行結果

<?php 
Class tcpDefine extends tcpdfEditer {

public function setHeader() {
//ヘッダー・フッター印刷しない
$this->setPrintHeader(false);

$this->setPrintFooter(0);
$this->setHeaderMargin(0);
$this->setFooterMargin(0);
//余白
$this->SetMargins(4,2,-1,true);

}

public function newPage() {
//ページ追加
$this->AddPage('L','A4');

}
public function setPage() {
//自動改ページ オフ
$this->SetAutoPageBreak(False, 0);

$a = $this->GetX();
$b = $this->GetY();
$vPos=2;
$hPos=5.1;
$this->SetFont('kozgopromedium', '',11);
$this->SetTextColor(0,0,0);
$source ='受 注 日';
$pos = $vPos;
$this->SetXY($hPos, $pos);
$this->Cell(19,8, $source, 0, 0,'C',0,'',0,0,'T','M');
////
$vPos=2;
$hPos=24;
$source ='図        番';
$pos = $vPos;
$info = $this->adjustToWidth($source, 54,kozgopromedium,11);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell(54,8, $source, 0, 0,'C',0,'',0,0,'T','M');
////
$vPos=2;
$hPos=77.5;
$source ='個数';
$pos = $vPos;
$info = $this->adjustToWidth($source, 11,kozgopromedium,11);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell(11,8, $source, 0, 0,'C',0,'',0,0,'T','M');
//
$vPos=2;
$hPos=88.2;
$source ='単  価';
$pos = $vPos;
$info = $this->adjustToWidth($source, 18,kozgopromedium,11);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell(18,8, $source, 0, 0,'C',0,'',0,0,'T','M');
//
$vPos=2;
$hPos=106.1;
$source ='納  期';
$pos = $vPos;
$this->SetXY($hPos, $pos);
$this->Cell(22,8, $source, 0, 0,'C',0,'',0,0,'T','M');
//
$vPos=2;
$hPos=128;
$source ='回数';
$pos = $vPos;
$this->SetXY($hPos, $pos);
$this->Cell(13,8, $source, 0, 0,'C',0,'',0,0,'T','M');
//
$vPos=2;
$hPos=163;
$this->SetFont('kozgopromedium', '',24);
$source ='製 造 指 示 書';
$pos = $vPos;
$this->SetXY($hPos, $pos);
$this->Cell(76,14, $source, 0, 0,'C',0,'',0,0,'T','M');
//
$vPos=2;
$hPos=246;
$this->SetFont('kozgopromedium', '',11);
$source =$this->_pdf_vars['No'];
$pos = $vPos;
$this->SetXY($hPos, $pos);
$this->Cell(13,8, $source, 0, 0,'R',0,'',0,0,'T','M');
//
$vPos=9.5;
$hPos=5.1;
$source =$this->_pdf_vars['day'];
$pos = $vPos;
$this->SetXY($hPos, $pos);
$this->Cell(8,13, $source, 0, 0,'C',0,'',0,0,'T','M');
//
$vPos=9.5;
$hPos=13.3;
$this->SetFont('kozgopromedium', '',22);
$this->SetTextColor(255,0,0);
$source ='Ⅹ';
$pos = $vPos;
$this->SetXY($hPos, $pos);
$this->Cell(11,13, $source, 0, 0,'C',0,'',0,0,'T','M');
//
$vPos=9.5;
$hPos=24;
$this->SetFont('kozgopromedium', '',18);
$this->SetTextColor(0,0,0);
$source =$this->_pdf_vars['zuban'];
$pos = $vPos;
$info = $this->adjustToWidth($source, 43,kozgopromedium,18);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell(43,13, $source, 0, 0,'C',0,'',0,0,'T','M');
//
$vPos=9.5;
$hPos=77.5;
$source =$this->_pdf_vars['kosuu'];
$pos = $vPos;
$this->SetXY($hPos, $pos);
$this->Cell(11,13, $source, 0, 0,'C',0,'',0,0,'T','M');
//
$vPos=9.5;
$hPos=88.2;
$source =$this->_pdf_vars['tanka'];
$pos = $vPos;
$info = $this->adjustToWidth($source, 18,kozgopromedium,18);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell(18,13, $source, 0, 0,'C',0,'',0,0,'T','M');
//
$vPos=9.5;
$hPos=106.1;
$source =$this->_pdf_vars['nouki'];
$pos = $vPos;
$this->SetXY($hPos, $pos);
$this->Cell(22,13, $source, 0, 0,'C',0,'',0,0,'T','M');
//
$vPos=9.5;
$hPos=128;
$source =$this->_pdf_vars['kaisuu'];
$pos = $vPos;
$this->SetXY($hPos, $pos);
$this->Cell(13,13, $source, 0, 0,'C',0,'',0,0,'T','M');
//
$vPos=22.9;
$hPos=163;
$this->SetFont('kozgopromedium', '',12);
$source ='検査部';
$pos = $vPos;
$this->SetXY($hPos, $pos);
$this->Cell(26,8, $source, 0, 0,'C',0,'',0,0,'T','M');
//
$vPos=22.9;
$hPos=189;
$source ='製造部';
$pos = $vPos;
$this->SetXY($hPos, $pos);
$this->Cell(26,8, $source, 0, 0,'C',0,'',0,0,'T','M');
//
$vPos=22.9;
$hPos=215;
$source ='設計部';
$pos = $vPos;
$this->SetXY($hPos, $pos);
$this->Cell(24,8, $source, 0, 0,'C',0,'',0,0,'T','M');
//
$vPos=25.9;
$hPos=5.1;
$this->SetFont('kozgopromedium', '',14);
$source ='正';
$pos = $vPos;
$this->SetXY($hPos, $pos);
$this->Cell(8,12, $source, 0, 0,'C',0,'',0,0,'T','M');
//
$vPos=25.9;
$hPos=13.3;
$this->SetFont('kozgopromedium', '',11);
$source =$this->_pdf_vars['oldday1'];
$pos = $vPos;
$this->SetXY($hPos, $pos);
$this->Cell(11,4, $source, 0, 0,'C',0,'',0,0,'T','M');
//
$vPos=25.9;
$hPos=24;
$source =$this->_pdf_vars['oldday2'];
$pos = $vPos;
$this->SetXY($hPos, $pos);
$this->Cell(11,4, $source, 0, 0,'C',0,'',0,0,'T','M');
//
$vPos=25.9;
$hPos=34.7;
$source =$this->_pdf_vars['oldday3'];
$pos = $vPos;
$this->SetXY($hPos, $pos);
$this->Cell(11,4, $source, 0, 0,'C',0,'',0,0,'T','M');
//
$vPos=25.9;
$hPos=45.4;
$source =$this->_pdf_vars['oldday4'];
$pos = $vPos;
$this->SetXY($hPos, $pos);
$this->Cell(11,4, $source, 0, 0,'C',0,'',0,0,'T','M');
//
$vPos=25.9;
$hPos=98.9;
$source ='年間予定数';
$pos = $vPos;
$this->SetXY($hPos, $pos);
$this->Cell(42,4, $source, 0, 0,'C',0,'',0,0,'T','M');
//
$vPos=30.4;
$hPos=13.3;
$this->SetFont('kozgopromedium', '',14);
$source =$this->_pdf_vars['oldsuu1'];
$pos = $vPos;
$info = $this->adjustToWidth($source, 11,kozgopromedium,14);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell(11,7, $source, 0, 0,'C',0,'',0,0,'T','M');
//
$vPos=30.4;
$hPos=24;
$source =$this->_pdf_vars['oldsuu2'];
$pos = $vPos;
$info = $this->adjustToWidth($source, 11,kozgopromedium,14);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell(11,7, $source, 0, 0,'C',0,'',0,0,'T','M');
//
$vPos=30.4;
$hPos=34.7;
$source =$this->_pdf_vars['oldsuu3'];
$pos = $vPos;
$info = $this->adjustToWidth($source, 11,kozgopromedium,14);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell(11,7, $source, 0, 0,'C',0,'',0,0,'T','M');
//
$vPos=30.4;
$hPos=45.4;
$source =$this->_pdf_vars['oldsuu4'];
$pos = $vPos;
$info = $this->adjustToWidth($source, 11,kozgopromedium,14);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell(11,7, $source, 0, 0,'C',0,'',0,0,'T','M');
//
$vPos=30.4;
$hPos=98.9;
$source ='正';
$pos = $vPos;
$this->SetXY($hPos, $pos);
$this->Cell(7,12, $source, 0, 0,'C',0,'',0,0,'T','M');
//
$vPos=37.7;
$hPos=5.1;
$source ='反';
$pos = $vPos;
$this->SetXY($hPos, $pos);
$this->Cell(8,12, $source, 0, 0,'C',0,'',0,0,'T','M');
//
$vPos=42.2;
$hPos=98.9;
$source ='反';
$pos = $vPos;
$this->SetXY($hPos, $pos);
$this->Cell(7,12, $source, 0, 0,'C',0,'',0,0,'T','M');
//
$vPos=49.5;
$hPos=5.1;
$source ='正';
$pos = $vPos;
$this->SetXY($hPos, $pos);
$this->Cell(8,12, $source, 0, 0,'C',0,'',0,0,'T','M');
//
$vPos=54;
$hPos=98.9;
$source ='MC';
$pos = $vPos;
$info = $this->adjustToWidth($source, 7,kozgopromedium,14);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell(7,19, $source, 0, 0,'L',0,'',0,0,'T','M');
//
$vPos=54;
$hPos=106.1;
$this->SetFont('kozgopromedium', '',18);
$source =$this->_pdf_vars['MC'];
$pos = $vPos;
$this->SetXY($hPos, $pos);
$this->Cell(35,19, $source, 0, 0,'C',0,'',0,0,'T','M');
//
$vPos=61.3;
$hPos=5.1;
$this->SetFont('kozgopromedium', '',14);
$source ='反';
$pos = $vPos;
$this->SetXY($hPos, $pos);
$this->Cell(8,12, $source, 0, 0,'C',0,'',0,0,'T','M');
//
$vPos=76.5;
$hPos=5.1;
$this->SetFont('kozgopromedium', '',12);
$source ='材  料';
$pos = $vPos;
$info = $this->adjustToWidth($source, 19,kozgopromedium,12);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell(19,11, $source, 0, 0,'C',0,'',0,0,'T','M');
//
$vPos=76.5;
$hPos=24;
$source ='寸   法';
$pos = $vPos;
$info = $this->adjustToWidth($source, 117,kozgopromedium,12);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell(117,11, $source, 0, 0,'C',0,'',0,0,'T','M');
//
$vPos=87.5;
$hPos=5.1;
$this->SetFont('kozgopromedium', '',18);
$source =$this->_pdf_vars['zairyo'];
$pos = $vPos;
$info = $this->adjustToWidth($source, 19,kozgopromedium,18);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell(19,11, $source, 0, 0,'C',0,'',0,0,'T','M');
//
$vPos=87.5;
$hPos=34.7;
$source =$this->_pdf_vars['sunpou'];
$pos = $vPos;
$this->SetXY($hPos, $pos);
$this->Cell(11,11, $source, 0, 0,'L',0,'',0,0,'T','M');
//
$vPos=98.5;
$hPos=5.1;
$source =$this->_pdf_vars['num1'];
$pos = $vPos;
$info = $this->adjustToWidth($source, 8,kozgopromedium,18);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell(8,11, $source, 0, 0,'C',0,'',0,0,'T','M');
//
$vPos=98.5;
$hPos=13.3;
$source =$this->_pdf_vars['sunpou1'];
$pos = $vPos;
$info = $this->adjustToWidth($source, 86,kozgopromedium,18);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell(86,11, $source, 0, 0,'L',0,'',0,0,'T','M');
//
$vPos=98.5;
$hPos=106.1;
$this->SetFont('kozgopromedium', '',16);
$bgcolor='242,242,242';
$rgb = explode(',', $bgcolor);
$this->SetFillColor($rgb[0],$rgb[1],$rgb[2]);
$source ='注文';
$pos = $vPos;
$info = $this->adjustToWidth($source, 35,kozgopromedium,16);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell(35,11, $source, 0, 0,'C',1,'',0,0,'T','M');
//
$vPos=109.5;
$hPos=5.1;
$this->SetFont('kozgopromedium', '',18);
$source =$this->_pdf_vars['num2'];
$pos = $vPos;
$info = $this->adjustToWidth($source, 8,kozgopromedium,18);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell(8,11, $source, 0, 0,'C',0,'',0,0,'T','M');
//
$vPos=109.5;
$hPos=13.3;
$source =$this->_pdf_vars['sunpou2'];
$pos = $vPos;
$info = $this->adjustToWidth($source, 86,kozgopromedium,18);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell(86,11, $source, 0, 0,'L',0,'',0,0,'T','M');
//
$vPos=109.5;
$hPos=106.1;
$this->SetFont('kozgopromedium', '',26);
$source =$this->_pdf_vars['chumon'];
$pos = $vPos;
$info = $this->adjustToWidth($source, 35,kozgopromedium,26);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell(35,11, $source, 0, 0,'C',0,'',0,0,'T','T');
//
$vPos=109.5;
$hPos=143.5;
$this->SetFont('kozgopromedium', '',18);
$this->SetTextColor(0,102,255);
$source ='1F棚№';
$pos = $vPos;
$info = $this->adjustToWidth($source, 26,kozgopromedium,18);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell(26,11, $source, 0, 0,'L',0,'',0,0,'T','M');
//
$vPos=109.5;
$hPos=169.5;
$this->SetFont('kozgopromedium', '',16);
$source =$this->_pdf_vars['1Ftana'];
$pos = $vPos;
$this->SetXY($hPos, $pos);
$this->Cell(32,11, $source, 0, 0,'C',0,'',0,0,'T','M');
//
$vPos=109.5;
$hPos=208.5;
$this->SetFont('kozgopromedium', '',18);
$source ='㋐ ㋒冶具方式';
$pos = $vPos;
$this->SetXY($hPos, $pos);
$this->Cell(6,11, $source, 0, 0,'L',0,'',0,0,'T','M');
//
$vPos=120.5;
$hPos=5.1;
$this->SetTextColor(0,0,0);
$source ='③';
$pos = $vPos;
$info = $this->adjustToWidth($source, 8,kozgopromedium,18);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell(8,11, $source, 0, 0,'C',0,'',0,0,'T','M');
//
$vPos=120.5;
$hPos=106.1;
$this->SetFont('kozgopromedium', '',12);
$source ='加工予定日';
$pos = $vPos;
for ($k= 0; $k != -1;  ) {
$info = $this->adjustToHeight($source, $k,7,6,11);
$k = $info['length'];
$text = $info['text'];
$this->SetXY($hPos, $pos);
$this->Cell(7, $info['height'],  $text, 0, 0,'L',0,'',0,0,'T','M');
$pos += $info['height'];
}
//
$vPos=120.5;
$hPos=143.5;
$this->SetFont('kozgopromedium', '',14);
$this->SetTextColor(0,102,255);
$source ='在庫(正)';
$pos = $vPos;
$info = $this->adjustToWidth($source, 26,kozgopromedium,14);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell(26,11, $source, 0, 0,'C',0,'',0,0,'T','M');
//
$vPos=120.5;
$hPos=169.5;
$source =$this->_pdf_vars['1Fzaiko'];
$pos = $vPos;
$info = $this->adjustToWidth($source, 20,kozgopromedium,14);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell(20,11, $source, 0, 0,'R',0,'',0,0,'T','M');
//
$vPos=120.5;
$hPos=189;
$source ='キ ズ';
$pos = $vPos;
$info = $this->adjustToWidth($source, 26,kozgopromedium,14);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell(26,11, $source, 0, 0,'C',0,'',0,0,'T','M');
//
$vPos=120.5;
$hPos=233;
$source ='材 料';
$pos = $vPos;
$info = $this->adjustToWidth($source, 26,kozgopromedium,14);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell(26,11, $source, 0, 0,'C',0,'',0,0,'T','M');
//
$vPos=120.5;
$hPos=259;
$source =$this->_pdf_vars['1Fzairyo'];
$pos = $vPos;
$info = $this->adjustToWidth($source, 18,kozgopromedium,14);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell(18,11, $source, 0, 0,'R',0,'',0,0,'T','M');
//
$vPos=131.5;
$hPos=5.1;
$this->SetFont('kozgopromedium', '',18);
$this->SetTextColor(0,0,0);
$source ='④';
$pos = $vPos;
$info = $this->adjustToWidth($source, 8,kozgopromedium,18);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell(8,11, $source, 0, 0,'C',0,'',0,0,'T','M');
//
$vPos=131.5;
$hPos=143.5;
$this->SetFont('kozgopromedium', '',14);
$this->SetTextColor(0,102,255);
$source ='在庫(反)';
$pos = $vPos;
$info = $this->adjustToWidth($source, 26,kozgopromedium,14);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell(26,11, $source, 0, 0,'C',0,'',0,0,'T','M');
//
$vPos=131.5;
$hPos=189;
$source ='二次加工';
$pos = $vPos;
$this->SetXY($hPos, $pos);
$this->Cell(26,11, $source, 0, 0,'C',0,'',0,0,'T','M');
//
$vPos=131.5;
$hPos=233;
$source ='その他';
$pos = $vPos;
$this->SetXY($hPos, $pos);
$this->Cell(26,11, $source, 0, 0,'C',0,'',0,0,'T','M');
//
$vPos=142.5;
$hPos=5.1;
$this->SetFont('kozgopromedium', '',16);
$this->SetTextColor(0,0,0);
$source ='1回  - 4本';
$pos = $vPos;
$info = $this->adjustToWidth($source, 40,kozgopromedium,16);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell(40,11, $source, 0, 0,'C',0,'',0,0,'T','M');
//
$vPos=142.5;
$hPos=45.4;
$source ='1本  - 8個';
$pos = $vPos;
$info = $this->adjustToWidth($source, 43,kozgopromedium,16);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell(43,11, $source, 0, 0,'C',0,'',0,0,'T','M');
//
$vPos=142.5;
$hPos=88.2;
$source ='4本  - 32個';
$pos = $vPos;
$info = $this->adjustToWidth($source, 53,kozgopromedium,16);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell(53,11, $source, 0, 0,'C',0,'',0,0,'T','M');
//
$vPos=142.5;
$hPos=143.5;
$this->SetFont('kozgopromedium', '',14);
$this->SetTextColor(0,102,255);
$source ='バリ・サビ';
$pos = $vPos;
$info = $this->adjustToWidth($source, 26,kozgopromedium,14);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell(26,11, $source, 0, 0,'C',0,'',0,0,'T','M');
//
$vPos=142.5;
$hPos=189;
$source ='溶 接';
$pos = $vPos;
$info = $this->adjustToWidth($source, 26,kozgopromedium,14);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell(26,11, $source, 0, 0,'C',0,'',0,0,'T','M');
//
$vPos=158.3;
$hPos=143.5;
$this->SetFont('kozgopromedium', '',18);
$this->SetTextColor(255,0,0);
$source ='2F棚№';
$pos = $vPos;
$info = $this->adjustToWidth($source, 26,kozgopromedium,18);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell(26,11, $source, 0, 0,'L',0,'',0,0,'T','M');
//
$vPos=158.3;
$hPos=208.5;
$source ='㋐ ㋒';
$pos = $vPos;
$this->SetXY($hPos, $pos);
$this->Cell(6,11, $source, 0, 0,'L',0,'',0,0,'T','M');
//
$vPos=169.3;
$hPos=143.5;
$this->SetFont('kozgopromedium', '',14);
$source ='在庫(正)';
$pos = $vPos;
$info = $this->adjustToWidth($source, 26,kozgopromedium,14);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell(26,11, $source, 0, 0,'C',0,'',0,0,'T','M');
//
$vPos=169.3;
$hPos=189;
$source ='キ ズ';
$pos = $vPos;
$info = $this->adjustToWidth($source, 26,kozgopromedium,14);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell(26,11, $source, 0, 0,'C',0,'',0,0,'T','M');
//
$vPos=169.3;
$hPos=233;
$source ='材 料';
$pos = $vPos;
$info = $this->adjustToWidth($source, 26,kozgopromedium,14);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell(26,11, $source, 0, 0,'C',0,'',0,0,'T','M');
//
$vPos=180.3;
$hPos=143.5;
$source ='在庫(反)';
$pos = $vPos;
$info = $this->adjustToWidth($source, 26,kozgopromedium,14);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell(26,11, $source, 0, 0,'C',0,'',0,0,'T','M');
//
$vPos=180.3;
$hPos=189;
$source ='二次加工';
$pos = $vPos;
$this->SetXY($hPos, $pos);
$this->Cell(26,11, $source, 0, 0,'C',0,'',0,0,'T','M');
//
$vPos=180.3;
$hPos=233;
$source ='その他';
$pos = $vPos;
$this->SetXY($hPos, $pos);
$this->Cell(26,11, $source, 0, 0,'C',0,'',0,0,'T','M');
//
$vPos=191.3;
$hPos=143.5;
$source ='バリ・サビ';
$pos = $vPos;
$info = $this->adjustToWidth($source, 26,kozgopromedium,14);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell(26,11, $source, 0, 0,'C',0,'',0,0,'T','M');
//
$vPos=191.3;
$hPos=189;
$source ='溶 接';
$pos = $vPos;
$info = $this->adjustToWidth($source, 26,kozgopromedium,14);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell(26,11, $source, 0, 0,'C',0,'',0,0,'T','M');
//

//罫線設定
$this->Line(5.1, 2, 140.7, 2, array('width' => 0.6, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(5.1, 9.5, 140.7, 9.5, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(13.3, 9.5, 13.3, 22.9, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(24, 2, 24, 22.9, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(77.5, 2, 77.5, 22.9, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(88.2, 2, 88.2, 22.9, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(106.1, 2, 106.1, 22.9, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(128, 2, 128, 22.9, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(5.1, 22.9, 140.7, 22.9, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(163, 22.9, 239.5, 22.9, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(5.1, 25.9, 140.7, 25.9, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(13.3, 30.4, 140.7, 30.4, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(163, 30.4, 239.5, 30.4, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(5.1, 37.7, 98.9, 37.7, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(13.3, 42.2, 140.7, 42.2, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(163, 22.9, 163, 42.2, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(189, 22.9, 189, 42.2, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(215, 22.9, 215, 42.2, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(239.5, 22.9, 239.5, 42.2, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(163, 42.2, 239.5, 42.2, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(5.1, 49.5, 98.9, 49.5, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(13.3, 54, 98.9, 54, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(98.9, 54, 140.7, 54, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(5.1, 61.3, 98.9, 61.3, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(13.3, 65.8, 98.9, 65.8, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(13.3, 25.9, 13.3, 73.1, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(24, 25.9, 24, 73.1, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(34.7, 25.9, 34.7, 73.1, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(45.4, 25.9, 45.4, 73.1, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(56.1, 25.9, 56.1, 73.1, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(66.8, 25.9, 66.8, 73.1, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(77.5, 25.9, 77.5, 73.1, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(88.2, 25.9, 88.2, 73.1, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(98.9, 25.9, 98.9, 73.1, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(106.1, 30.4, 106.1, 73.1, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(5.1, 73.1, 140.7, 73.1, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(5.1, 76.5, 140.7, 76.5, array('width' => 0.6, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(5.1, 87.5, 140.7, 87.5, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(24, 76.5, 24, 98.5, array('width' => 0.6, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(5.1, 98.5, 140.7, 98.5, array('width' => 0.6, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(5.1, 109.5, 106.1, 109.5, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 1, 'color' => array(0,0,0)));
$this->Line(106.1, 108.8, 140.7, 108.8, array('width' => 0.1, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(106.1, 109.5, 140.7, 109.5, array('width' => 0.1, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(143.5, 109.5, 202, 109.5, array('width' => 0.6, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,102,255)));
//$this->Line(106.8, 98.5, 106.8, 120.5, array('width' => 0.1, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(106.1, 98.5, 106.1, 120.5, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(5.1, 120.5, 106.1, 120.5, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 1, 'color' => array(0,0,0)));
$this->Line(106.1, 120.5, 140.7, 120.5, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(169.5, 109.5, 169.5, 120.5, array('width' => 0.6, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,102,255)));
$this->Line(202, 109.5, 202, 120.5, array('width' => 0.6, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,102,255)));
$this->Line(143.5, 120.5, 277, 120.5, array('width' => 0.6, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,102,255)));
$this->Line(5.1, 131.5, 106.1, 131.5, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 1, 'color' => array(0,0,0)));
$this->Line(143.5, 131.5, 277, 131.5, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,102,255)));
$this->Line(106.1, 120.5, 106.1, 142.5, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(113.1, 120.5, 113.1, 142.5, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(5.1, 142.5, 140.7, 142.5, array('width' => 0.6, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(143.5, 142.5, 277, 142.5, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,102,255)));
$this->Line(45.4, 142.5, 45.4, 153.5, array('width' => 0.6, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(88.2, 142.5, 88.2, 153.5, array('width' => 0.6, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(5.1, 153.5, 140.7, 153.5, array('width' => 0.6, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(143.5, 109.5, 143.5, 153.5, array('width' => 0.6, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,102,255)));
$this->Line(169.5, 120.5, 169.5, 153.5, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,102,255)));
$this->Line(189, 120.5, 189, 153.5, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,102,255)));
$this->Line(215, 120.5, 215, 153.5, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,102,255)));
$this->Line(233, 120.5, 233, 153.5, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,102,255)));
$this->Line(259, 120.5, 259, 153.5, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,102,255)));
$this->Line(277, 120.5, 277, 153.5, array('width' => 0.6, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,102,255)));
$this->Line(143.5, 153.5, 277, 153.5, array('width' => 0.6, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,102,255)));
$this->Line(143.5, 158.3, 202, 158.3, array('width' => 0.6, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(255,0,0)));
$this->Line(169.5, 158.3, 169.5, 169.3, array('width' => 0.6, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(255,0,0)));
$this->Line(202, 158.3, 202, 169.3, array('width' => 0.6, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(255,0,0)));
$this->Line(143.5, 169.3, 277, 169.3, array('width' => 0.6, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(255,0,0)));
$this->Line(143.5, 180.3, 277, 180.3, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(255,0,0)));
$this->Line(143.5, 191.3, 277, 191.3, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(255,0,0)));
$this->Line(5.1, 2, 5.1, 202.3, array('width' => 0.6, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(140.7, 2, 140.7, 202.3, array('width' => 0.6, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(5.1, 202.3, 140.7, 202.3, array('width' => 0.6, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(143.5, 158.3, 143.5, 202.3, array('width' => 0.6, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(255,0,0)));
$this->Line(169.5, 169.3, 169.5, 202.3, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(255,0,0)));
$this->Line(189, 169.3, 189, 202.3, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(255,0,0)));
$this->Line(215, 169.3, 215, 202.3, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(255,0,0)));
$this->Line(233, 169.3, 233, 202.3, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(255,0,0)));
$this->Line(259, 169.3, 259, 202.3, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(255,0,0)));
$this->Line(277, 169.3, 277, 202.3, array('width' => 0.6, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(255,0,0)));
$this->Line(143.5, 202.3, 277, 202.3, array('width' => 0.6, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(255,0,0)));
}
}

?>

 ジェネレートの処理時間は約1分ほど要した。

ブラウザでのPDF表示は、1~2秒程度で表示された。

PDF実行結果

赤枠が「折り返して全体表示」のセルであるが、はみ出してしまった。
高さによっては、フォントサイズを下げる処理が必要である。Excelで予めフォントサイズを下げておく手もあるが。

また、青枠のように列の繰り返しにはまだ対応できていない。今回はそれぞれの列に変数を定義した。

また、フォント対応が明朝とゴシックのどちらかであるが、今回はExcelのPDF化ではなく、TCPDF実行の定義ファイルの出力が目的であるので、こちらは目をつぶることにした。

因みに、表示するためのPHPのソースは

    <?php
	require_once(dirname(__FILE__)."/../lib/TCPDF-master/tcpdf.php");
	require_once(dirname(__FILE__)."/tcpdfEditer.php");
	require_once(dirname(__FILE__)."/sample1.php");

	$pdf = new tcpDefine();

	$pdf->assign('No','1');
	$pdf->assign('day','8/8');
	$pdf->assign('zuban','HFA-450-091');
	$pdf->assign('kosuu','10');
	$pdf->assign('tanka','12,000');
	$pdf->assign('nouki','9/1');
	$pdf->assign('kaisuu','5');
	$pdf->assign('oldday1','16-11');
	$pdf->assign('oldday2','17-2');
	$pdf->assign('oldday3','3');
	$pdf->assign('oldday4','6');
	$pdf->assign('oldsuu1','10');
	$pdf->assign('oldsuu2','10');
	$pdf->assign('oldsuu3','10');
	$pdf->assign('oldsuu4','10');
	$pdf->assign('MC','1');
	$pdf->assign('zairyo','S45C');
	$pdf->assign('sunpou','12x22x4000=10本');
	$pdf->assign('num1','①')
$pdf->assign('sunpou1','12x22x1130=30本=240ヶ'); $pdf->assign('num2','②')
$pdf->assign('sunpou2','残材 610=10本=40ヶ'); $pdf->assign('chumon','280ヶ'); $pdf->assign('1Ftana','ア-1'); $pdf->assign('1Fzaiko','18'); $pdf->assign('1Fzairyo','4'); //PDF出力 $pdf->setHeader(); $pdf->newPage(); $pdf->out('sample.pdf', 'I'); ?>

 

リテラルで代入しているが、DBからデータを取得して代入すればよい。

イメージ通りのものを、簡単にTCPDFで出力できるようになった。