PHPでPDF出力(tcpdf) 10 (ついに完成)

10.ExcelからTCPDF定義ファイル作成

Excelで帳票設計して、TCPDFでPDF帳票出力するためのジェネレーターが完成した。

完成したジェネレーターの実行画面である。

  ジェネレーター

帳票設計のExcelPHPで実行したTCPDF定義ファイルと出力されたPDFである。

   Excelレイアウト

 

   出力PDF帳票

 出力されたTCPDF定義を少々長くなる(899行)が載せておく。

<?php

Class tcpDefine extends  tcpdfEditoer {

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

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

}

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

}

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

$a = $this->GetX();
$b = $this->GetY();
$wd=21;
$vPos=3.6;
$hPos=3.8;
$this->SetFont('kozgopromedium', '',11);
$this->SetTextColor(0,0,0);
$source ='受 注 日';
$pos = $vPos;
$this->SetXY($hPos, $pos);
$this->Cell($wd,7, $source, 0, 0,'C',0,'',0,0,'T','M');
$wd=59;
$vPos=3.6;
$hPos=24.5;
$source ='図 番';
$pos = $vPos;
$info = $this->adjustToWidth($source, $wd,'kozgopromedium',11);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell($wd,7, $source, 0, 0,'C',0,'',0,0,'T','M');
$wd=12;
$vPos=3.6;
$hPos=83;
$source ='個数';
$pos = $vPos;
$info = $this->adjustToWidth($source, $wd,'kozgopromedium',11);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell($wd,7, $source, 0, 0,'C',0,'',0,0,'T','M');
$wd=20;
$vPos=3.6;
$hPos=94.7;
$source ='単 価';
$pos = $vPos;
$info = $this->adjustToWidth($source, $wd,'kozgopromedium',11);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell($wd,7, $source, 0, 0,'C',0,'',0,0,'T','M');
$wd=18;
$vPos=3.6;
$hPos=114.9;
$source ='納 期';
$pos = $vPos;
$this->SetXY($hPos, $pos);
$this->Cell($wd,7, $source, 0, 0,'C',0,'',0,0,'T','M');
$wd=12;
$vPos=3.6;
$hPos=133.1;
$source ='回数';
$pos = $vPos;
$this->SetXY($hPos, $pos);
$this->Cell($wd,7, $source, 0, 0,'C',0,'',0,0,'T','M');
$wd=84;
$vPos=3.6;
$hPos=169.5;
$this->SetFont('kozgopromedium', '',22);
$source ='製 造 指 示 書';
$pos = $vPos;
$this->SetXY($hPos, $pos);
$this->Cell($wd,14, $source, 0, 0,'C',0,'',0,0,'T','M');
$wd=13;
$vPos=3.6;
$hPos=274.5;
$this->SetFont('kozgopromedium', '',12);
$source ='No.1';
$pos = $vPos;
$this->SetXY($hPos, $pos);
$this->Cell($wd,7, $source, 0, 0,'L',0,'',0,0,'T','M');
$wd=9;
$vPos=10.6;
$hPos=3.8;
$this->SetFont('kozgopromedium', '',11);
$source =$this->_pdf_vars['day'];
$pos = $vPos;
$this->SetXY($hPos, $pos);
$this->Cell($wd,13, $source, 0, 0,'C',0,'',0,0,'T','M');
$wd=12;
$vPos=10.6;
$hPos=12.8;
$this->SetFont('kozgopromedium', '',22);
$this->SetTextColor(255,0,0);
$source ='Ⅹ';
$pos = $vPos;
$this->SetXY($hPos, $pos);
$this->Cell($wd,13, $source, 0, 0,'C',0,'',0,0,'T','M');
$wd=47;
$vPos=10.6;
$hPos=24.5;
$this->SetFont('kozgopromedium', '',18);
$this->SetTextColor(0,0,0);
$source =$this->_pdf_vars['seizou'];
$pos = $vPos;
$info = $this->adjustToWidth($source, $wd,'kozgopromedium',18);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell($wd,13, $source, 0, 0,'C',0,'',0,0,'T','M');
$wd=12;
$vPos=10.6;
$hPos=83;
$source =$this->_pdf_vars['kosuu'];
$pos = $vPos;
$info = $this->adjustToWidth($source, $wd,'kozgopromedium',18);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell($wd,13, $source, 0, 0,'C',0,'',0,0,'T','M');
$wd=20;
$vPos=10.6;
$hPos=94.7;
$source =$this->_pdf_vars['tanka'];
$pos = $vPos;
$info = $this->adjustToWidth($source, $wd,'kozgopromedium',18);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell($wd,13, $source, 0, 0,'C',0,'',0,0,'T','M');
$wd=18;
$vPos=10.6;
$hPos=114.9;
$source =$this->_pdf_vars['nouki'];
$pos = $vPos;
$this->SetXY($hPos, $pos);
$this->Cell($wd,13, $source, 0, 0,'C',0,'',0,0,'T','M');
$wd=12;
$vPos=10.6;
$hPos=133.1;
$source =$this->_pdf_vars['kai'];
$pos = $vPos;
$this->SetXY($hPos, $pos);
$this->Cell($wd,13, $source, 0, 0,'C',0,'',0,0,'T','M');
$wd=28;
$vPos=24;
$hPos=169.5;
$this->SetFont('kozgopromedium', '',12);
$source ='検査部';
$pos = $vPos;
$this->SetXY($hPos, $pos);
$this->Cell($wd,8, $source, 0, 0,'C',0,'',0,0,'T','M');
$wd=28;
$vPos=24;
$hPos=197.5;
$source ='製造部';
$pos = $vPos;
$this->SetXY($hPos, $pos);
$this->Cell($wd,8, $source, 0, 0,'C',0,'',0,0,'T','M');
$wd=28;
$vPos=24;
$hPos=225.5;
$source ='設計部';
$pos = $vPos;
$this->SetXY($hPos, $pos);
$this->Cell($wd,8, $source, 0, 0,'C',0,'',0,0,'T','M');
$wd=9;
$vPos=27.4;
$hPos=3.8;
$this->SetFont('kozgopromedium', '',14);
$source ='正';
$pos = $vPos;
$this->SetXY($hPos, $pos);
$this->Cell($wd,12, $source, 0, 0,'C',0,'',0,0,'T','M');
$wd=12;
$wd=12;

// 列の幅
// 行高さ
$hi = 4;
// 列の開始位置
$col = 3;
$maxCol = 10;
$hPos=12.8;
$vPos=27.4;
foreach ($this->_pdf_vars['hstday'] as $key) {
$source = $key['day'];
$this->SetTextColor(0,0,0);
$this->SetXY($hPos, $vPos);
$info = $this->adjustToWidth($source, $wd,'kozgopromedium,'11);
$this->SetFont('kozgopromedium', '',$info);
$this->Cell( $wd, $hi, $source, 0, 0,'C',0,'',0,0,'T','M');
$hPos += $wd;
$col++;
}
$wd=39;
$vPos=27.4;
$hPos=106.4;
$this->SetFont('kozgopromedium', '',11);
$source ='年間予定数';
$pos = $vPos;
$this->SetXY($hPos, $pos);
$this->Cell($wd,4, $source, 0, 0,'C',0,'',0,0,'T','M');
$wd=12;
$wd=12;

// 列の幅
// 行高さ
$hi = 7;
// 列の開始位置
$col = 3;
$maxCol = 10;
$hPos=12.8;
$vPos=31.9;
foreach ($this->_pdf_vars['hstsuu'] as $key) {
$source = $key['su'];
$this->SetTextColor(0,0,0);
$this->SetXY($hPos, $vPos);
$info = $this->adjustToWidth($source, $wd,'kozgopromedium',14);
$this->SetFont('kozgopromedium', '',$info);
$this->Cell( $wd, $hi, $source, 0, 0,'C',0,'',0,0,'T','M');
$hPos += $wd;
$col++;
}
$wd=8;
$vPos=31.9;
$hPos=106.4;
$this->SetFont('kozgopromedium', '',14);
$source ='正';
$pos = $vPos;
$this->SetXY($hPos, $pos);
$this->Cell($wd,12, $source, 0, 0,'C',0,'',0,0,'T','M');
$wd=9;
$vPos=39.2;
$hPos=3.8;
$source ='反';
$pos = $vPos;
$this->SetXY($hPos, $pos);
$this->Cell($wd,12, $source, 0, 0,'C',0,'',0,0,'T','M');
$wd=8;
$vPos=43.7;
$hPos=106.4;
$source ='反';
$pos = $vPos;
$this->SetXY($hPos, $pos);
$this->Cell($wd,12, $source, 0, 0,'C',0,'',0,0,'T','M');
$wd=9;
$vPos=51;
$hPos=3.8;
$source ='正';
$pos = $vPos;
$this->SetXY($hPos, $pos);
$this->Cell($wd,12, $source, 0, 0,'C',0,'',0,0,'T','M');
$wd=8;
$vPos=55.5;
$hPos=106.4;
$this->SetFont('kozgopromedium', '',18);
$source ='MC';
$pos = $vPos;
$chrcnt=0;
for ($k= 0; $k != -1; ) {
$info = $this->adjustToHeight($source, $k,8,7,7.3,'kozgopromedium',18,$chrcnt);
$k = $info['length'];
$text = $info['text'];
$this->SetXY($hPos, $pos);
$this->Cell(8, $info['height'], $text, 0, 0,'C',0,'',0,0,'T','T');
$pos += $info['height'];
$chrcnt = $info['count'];
}
$wd=31;
$vPos=55.5;
$hPos=114.9;
$source ='1';
$pos = $vPos;
$this->SetXY($hPos, $pos);
$this->Cell($wd,19, $source, 0, 0,'C',0,'',0,0,'T','M');
$wd=9;
$vPos=62.8;
$hPos=3.8;
$this->SetFont('kozgopromedium', '',14);
$source ='反';
$pos = $vPos;
$this->SetXY($hPos, $pos);
$this->Cell($wd,12, $source, 0, 0,'C',0,'',0,0,'T','M');
$wd=21;
$vPos=78;
$hPos=3.8;
$this->SetFont('kozgopromedium', '',12);
$source ='材  料';
$pos = $vPos;
$info = $this->adjustToWidth($source, $wd,'kozgopromedium',12);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell($wd,11, $source, 0, 0,'C',0,'',0,0,'T','M');
$wd=121;
$vPos=78;
$hPos=24.5;
$source ='寸   法';
$pos = $vPos;
$info = $this->adjustToWidth($source, $wd,'kozgopromedium,'12);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell($wd,11, $source, 0, 0,'C',0,'',0,0,'T','M');
$wd=21;
$vPos=89;
$hPos=3.8;
$this->SetFont('kozgopromedium', '',18);
$source =$this->_pdf_vars['zairyo'];
$pos = $vPos;
$info = $this->adjustToWidth($source, $wd,'kozgopromedium',18);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell($wd,11, $source, 0, 0,'C',0,'',0,0,'T','M');
$wd=109;
$vPos=89;
$hPos=36.2;
$source =$this->_pdf_vars['size'];
$pos = $vPos;
$info = $this->adjustToWidth($source, $wd,'kozgopromedium',18);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell($wd,11, $source, 0, 0,'L',0,'',0,0,'T','M');
$wd=9;

// 行の高さ
$hi = 11;
// 行の開始位置
$vPos = 100;
$row = 16;
$maxRow = 19;
foreach ($this->_pdf_vars['lpdata'] as $key) {
$hPos=3.8;
$wd = 9;
$this->SetTextColor(0,0,0);
$source = $key['num'];
$this->SetXY($hPos, $vPos);
$info = $this->adjustToWidth($source, $wd,'kozgopromedium',18);
$this->SetFont('kozgopromedium', '',$info);
$this->Cell( $wd, $hi, $source, 0, 0,'C',0,'',0,0,'T','M');
$hPos=12.8;
$wd = 102;
$this->SetTextColor(0,0,0);
$source = $key['zai'];
$this->SetXY($hPos, $vPos);
$info = $this->adjustToWidth($source, $wd,'kozgopromedium',18);
$this->SetFont('kozgopromedium', '',$info);
$this->Cell( $wd, $hi, $source, 0, 0,'L',0,'',0,0,'T','M');
$vPos += $hi;
$row++;
}
$wd=31;
$vPos=100;
$hPos=114.9;
$this->SetFont('kozgopromedium', '',14);
$source ='注文';
$pos = $vPos;
$this->SetXY($hPos, $pos);
$this->Cell($wd,11, $source, 0, 0,'C',0,'',0,0,'T','M');
$wd=31;
$vPos=111;
$hPos=114.9;
$this->SetFont('kozgopromedium', '',24);
$source =$this->_pdf_vars['chumon'];
$pos = $vPos;
$info = $this->adjustToWidth($source, $wd,'kozgopromedium',24);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell($wd,11, $source, 0, 0,'C',0,'',0,0,'T','T');
$wd=28;
$vPos=111;
$hPos=148.5;
$this->SetFont('kozgopromedium', '',18);
$this->SetTextColor(0,102,255);
$source ='1F棚№';
$pos = $vPos;
$info = $this->adjustToWidth($source, $wd,'kozgopromedium',18);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell($wd,11, $source, 0, 0,'L',0,'',0,0,'T','M');
$wd=35;
$vPos=111;
$hPos=176.5;
$this->SetFont('kozgopromedium', '',16);
$source =$this->_pdf_vars['tana1f'];
$pos = $vPos;
$this->SetXY($hPos, $pos);
$this->Cell($wd,11, $source, 0, 0,'C',0,'',0,0,'T','M');
$wd=7;
$vPos=111;
$hPos=218.5;
$this->SetFont('kozgopromedium', '',18);
$source ='㋐ ㋒冶具方式';
$pos = $vPos;
$this->SetXY($hPos, $pos);
$this->Cell($wd,11, $source, 0, 0,'L',0,'',0,0,'T','M');
$wd=7;
$vPos=122;
$hPos=114.9;
$this->SetFont('kozgopromedium', '',10);
$this->SetTextColor(0,0,0);
$source ='加工予定日';
$pos = $vPos;
$chrcnt=0;
for ($k= 0; $k != -1; ) {
$info = $this->adjustToHeight($source, $k,7,6,11,'kozgopromedium',10,$chrcnt);
$k = $info['length'];
$text = $info['text'];
$this->SetXY($hPos, $pos);
$this->Cell(7, $info['height'], $text, 0, 0,'C',0,'',0,0,'T','M');
$pos += $info['height'];
$chrcnt = $info['count'];
}
$wd=28;
$vPos=122;
$hPos=148.5;
$this->SetFont('kozgopromedium', '',14);
$this->SetTextColor(0,102,255);
$source ='在庫(正)';
$pos = $vPos;
$info = $this->adjustToWidth($source, $wd,'kozgopromedium',14);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell($wd,11, $source, 0, 0,'C',0,'',0,0,'T','M');
$wd=21;
$vPos=122;
$hPos=176.5;
$this->SetFont('kozgopromedium', '',12);
$source =$this->_pdf_vars['zaiko1f'];
$pos = $vPos;
$info = $this->adjustToWidth($source, $wd,'kozgopromedium',12);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell($wd,11, $source, 0, 0,'C',0,'',0,0,'T','M');
$wd=28;
$vPos=122;
$hPos=197.5;
$this->SetFont('kozgopromedium', '',14);
$source ='キ ズ';
$pos = $vPos;
$info = $this->adjustToWidth($source, $wd,'kozgopromedium',14);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell($wd,11, $source, 0, 0,'C',0,'',0,0,'T','M');
$wd=21;
$vPos=122;
$hPos=225.5;
$this->SetFont('kozgopromedium', '',12);
$source =$this->_pdf_vars['kizu1f'];
$pos = $vPos;
$info = $this->adjustToWidth($source, $wd,'kozgopromedium',12);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell($wd,11, $source, 0, 0,'C',0,'',0,0,'T','M');
$wd=28;
$vPos=122;
$hPos=246.5;
$this->SetFont('kozgopromedium', '',14);
$source ='材 料';
$pos = $vPos;
$info = $this->adjustToWidth($source, $wd,'kozgopromedium',14);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell($wd,11, $source, 0, 0,'C',0,'',0,0,'T','M');
$wd=18;
$vPos=122;
$hPos=274.5;
$this->SetFont('kozgopromedium', '',12);
$source =$this->_pdf_vars['zai1f'];
$pos = $vPos;
$info = $this->adjustToWidth($source, $wd,'kozgopromedium',12);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell($wd,11, $source, 0, 0,'C',0,'',0,0,'T','M');
$wd=9;

$wd=28;
$vPos=133;
$hPos=148.5;
$this->SetFont('kozgopromedium', '',14);
$source ='在庫(反)';
$pos = $vPos;
$info = $this->adjustToWidth($source, $wd,'kozgopromedium',14);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell($wd,12, $source, 0, 0,'C',0,'',0,0,'T','M');
$wd=21;
$vPos=133;
$hPos=176.5;
$this->SetFont('kozgopromedium', '',11);
$source =$this->_pdf_vars['zaiko01f'];
$pos = $vPos;
$info = $this->adjustToWidth($source, $wd,'kozgopromedium,'11);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell($wd,12, $source, 0, 0,'C',0,'',0,0,'T','M');
$wd=28;
$vPos=133;
$hPos=197.5;
$this->SetFont('kozgopromedium', '',14);
$source ='二次加工';
$pos = $vPos;
$this->SetXY($hPos, $pos);
$this->Cell($wd,12, $source, 0, 0,'C',0,'',0,0,'T','M');
$wd=21;
$vPos=133;
$hPos=225.5;
$this->SetFont('kozgopromedium', '',11);
$source =$this->_pdf_vars['niji1f'];
$pos = $vPos;
$info = $this->adjustToWidth($source, $wd,'kozgopromedium',11);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell($wd,12, $source, 0, 0,'C',0,'',0,0,'T','M');
$wd=28;
$vPos=133;
$hPos=246.5;
$this->SetFont('kozgopromedium', '',14);
$source ='その他';
$pos = $vPos;
$this->SetXY($hPos, $pos);
$this->Cell($wd,12, $source, 0, 0,'C',0,'',0,0,'T','M');
$wd=18;
$vPos=133;
$hPos=274.5;
$this->SetFont('kozgopromedium', '',12);
$source =$this->_pdf_vars['etc1f'];
$pos = $vPos;
$info = $this->adjustToWidth($source, $wd,'kozgopromedium',12);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell($wd,12, $source, 0, 0,'C',0,'',0,0,'T','M');
$wd=44;
$vPos=144.9;
$hPos=3.8;
$this->SetFont('kozgopromedium', '',16);
$this->SetTextColor(0,0,0);
$source ='1回 - 4本';
$pos = $vPos;
$info = $this->adjustToWidth($source, $wd,'kozgopromedium',16);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell($wd,11, $source, 0, 0,'C',0,'',0,0,'T','M');
$wd=47;
$vPos=144.9;
$hPos=47.9;
$source ='1本 - 8個';
$pos = $vPos;
$info = $this->adjustToWidth($source, $wd,'kozgopromedium',16);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell($wd,11, $source, 0, 0,'C',0,'',0,0,'T','M');
$wd=51;
$vPos=144.9;
$hPos=94.7;
$source ='4本 - 32個';
$pos = $vPos;
$info = $this->adjustToWidth($source, $wd,'kozgopromedium,'16);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell($wd,11, $source, 0, 0,'C',0,'',0,0,'T','M');
$wd=28;
$vPos=144.9;
$hPos=148.5;
$this->SetFont('kozgopromedium', '',14);
$this->SetTextColor(0,102,255);
$source ='バリ・サビ';
$pos = $vPos;
$info = $this->adjustToWidth($source, $wd,'kozgopromedium',14);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell($wd,11, $source, 0, 0,'C',0,'',0,0,'T','M');
$wd=21;
$vPos=144.9;
$hPos=176.5;
$this->SetFont('kozgopromedium', '',12);
$source =$this->_pdf_vars['bari1f'];
$pos = $vPos;
$info = $this->adjustToWidth($source, $wd,'kozgopromedium',12);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell($wd,11, $source, 0, 0,'R',0,'',0,0,'T','M');
$wd=28;
$vPos=144.9;
$hPos=197.5;
$this->SetFont('kozgopromedium', '',14);
$source ='溶 接';
$pos = $vPos;
$info = $this->adjustToWidth($source, $wd,'kozgopromedium',14);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell($wd,11, $source, 0, 0,'C',0,'',0,0,'T','M');
$wd=21;
$vPos=144.9;
$hPos=225.5;
$this->SetFont('kozgopromedium', '',12);
$source =$this->_pdf_vars['yousetu1f'];
$pos = $vPos;
$info = $this->adjustToWidth($source, $wd,'kozgopromedium',12);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell($wd,11, $source, 0, 0,'C',0,'',0,0,'T','M');
$wd=28;
$vPos=164.1;
$hPos=148.5;
$this->SetFont('kozgopromedium', '',18);
$this->SetTextColor(255,0,0);
$source ='2F棚№';
$pos = $vPos;
$info = $this->adjustToWidth($source, $wd,'kozgopromedium',18);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell($wd,11, $source, 0, 0,'L',0,'',0,0,'T','M');
$wd=35;
$vPos=164.1;
$hPos=176.5;
$this->SetFont('kozgopromedium', '',16);
$this->SetTextColor(0,0,0);
$source =$this->_pdf_vars['tana2f'];
$pos = $vPos;
$this->SetXY($hPos, $pos);
$this->Cell($wd,11, $source, 0, 0,'C',0,'',0,0,'T','M');
$wd=7;
$vPos=164.1;
$hPos=218.5;
$this->SetFont('kozgopromedium', '',18);
$this->SetTextColor(255,0,0);
$source ='㋐ ㋒';
$pos = $vPos;
$this->SetXY($hPos, $pos);
$this->Cell($wd,11, $source, 0, 0,'L',0,'',0,0,'T','M');
$wd=28;
$vPos=175.1;
$hPos=148.5;
$this->SetFont('kozgopromedium', '',14);
$source ='在庫(正)';
$pos = $vPos;
$info = $this->adjustToWidth($source, $wd,'kozgopromedium',14);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell($wd,11, $source, 0, 0,'C',0,'',0,0,'T','M');
$wd=21;
$vPos=175.1;
$hPos=176.5;
$this->SetFont('kozgopromedium', '',12);
$this->SetTextColor(0,0,0);
$source =$this->_pdf_vars['zaiko2f'];
$pos = $vPos;
$info = $this->adjustToWidth($source, $wd,'kozgopromedium',12);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell($wd,11, $source, 0, 0,'C',0,'',0,0,'T','M');
$wd=28;
$vPos=175.1;
$hPos=197.5;
$this->SetFont('kozgopromedium', '',14);
$this->SetTextColor(255,0,0);
$source ='キ ズ';
$pos = $vPos;
$info = $this->adjustToWidth($source, $wd,'kozgopromedium',14);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell($wd,11, $source, 0, 0,'C',0,'',0,0,'T','M');
$wd=21;
$vPos=175.1;
$hPos=225.5;
$this->SetFont('kozgopromedium', '',12);
$this->SetTextColor(0,0,0);
$source =$this->_pdf_vars['kizui2f'];
$pos = $vPos;
$info = $this->adjustToWidth($source, $wd,'kozgopromedium',12);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell($wd,11, $source, 0, 0,'C',0,'',0,0,'T','M');
$wd=28;
$vPos=175.1;
$hPos=246.5;
$this->SetFont('kozgopromedium', '',14);
$this->SetTextColor(255,0,0);
$source ='材 料';
$pos = $vPos;
$info = $this->adjustToWidth($source, $wd,'kozgopromedium',14);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell($wd,11, $source, 0, 0,'C',0,'',0,0,'T','M');
$wd=18;
$vPos=175.1;
$hPos=274.5;
$this->SetFont('kozgopromedium', '',12);
$this->SetTextColor(0,0,0);
$source =$this->_pdf_vars['zai2f'];
$pos = $vPos;
$info = $this->adjustToWidth($source, $wd,'kozgopromedium',12);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell($wd,11, $source, 0, 0,'C',0,'',0,0,'T','M');
$wd=28;
$vPos=186.1;
$hPos=148.5;
$this->SetFont('kozgopromedium', '',14);
$this->SetTextColor(255,0,0);
$source ='在庫(反)';
$pos = $vPos;
$info = $this->adjustToWidth($source, $wd,'kozgopromedium',14);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell($wd,11, $source, 0, 0,'C',0,'',0,0,'T','M');
$wd=21;
$vPos=186.1;
$hPos=176.5;
$this->SetFont('kozgopromedium', '',12);
$this->SetTextColor(0,0,0);
$source =$this->_pdf_vars['zaiko02f'];
$pos = $vPos;
$info = $this->adjustToWidth($source, $wd,'kozgopromedium',12);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell($wd,11, $source, 0, 0,'C',0,'',0,0,'T','M');
$wd=28;
$vPos=186.1;
$hPos=197.5;
$this->SetFont('kozgopromedium', '',14);
$this->SetTextColor(255,0,0);
$source ='二次加工';
$pos = $vPos;
$this->SetXY($hPos, $pos);
$this->Cell($wd,11, $source, 0, 0,'C',0,'',0,0,'T','M');
$wd=21;
$vPos=186.1;
$hPos=225.5;
$this->SetFont('kozgopromedium', '',12);
$this->SetTextColor(0,0,0);
$source =$this->_pdf_vars['niji2f'];
$pos = $vPos;
$info = $this->adjustToWidth($source, $wd,'kozgopromedium',12);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell($wd,11, $source, 0, 0,'C',0,'',0,0,'T','M');
$wd=28;
$vPos=186.1;
$hPos=246.5;
$this->SetFont('kozgopromedium', '',14);
$this->SetTextColor(255,0,0);
$source ='その他';
$pos = $vPos;
$this->SetXY($hPos, $pos);
$this->Cell($wd,11, $source, 0, 0,'C',0,'',0,0,'T','M');
$wd=18;
$vPos=186.1;
$hPos=274.5;
$this->SetFont('kozgopromedium', '',12);
$this->SetTextColor(0,0,0);
$source =$this->_pdf_vars['etc2f'];
$pos = $vPos;
$info = $this->adjustToWidth($source, $wd,'kozgopromedium',12);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell($wd,11, $source, 0, 0,'C',0,'',0,0,'T','M');
$wd=28;
$vPos=197.1;
$hPos=148.5;
$this->SetFont('kozgopromedium', '',14);
$this->SetTextColor(255,0,0);
$source ='バリ・サビ';
$pos = $vPos;
$info = $this->adjustToWidth($source, $wd,'kozgopromedium',14);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell($wd,11, $source, 0, 0,'C',0,'',0,0,'T','M');
$wd=21;
$vPos=197.1;
$hPos=176.5;
$this->SetFont('kozgopromedium', '',12);
$this->SetTextColor(0,0,0);
$source =$this->_pdf_vars['bari2f'];
$pos = $vPos;
$info = $this->adjustToWidth($source, $wd,'kozgopromedium',12);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell($wd,11, $source, 0, 0,'C',0,'',0,0,'T','M');
$wd=28;
$vPos=197.1;
$hPos=197.5;
$this->SetFont('kozgopromedium', '',14);
$this->SetTextColor(255,0,0);
$source ='溶 接';
$pos = $vPos;
$info = $this->adjustToWidth($source, $wd,'kozgopromedium',14);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell($wd,11, $source, 0, 0,'C',0,'',0,0,'T','M');
$wd=21;
$vPos=197.1;
$hPos=225.5;
$this->SetFont('kozgopromedium', '',12);
$this->SetTextColor(0,0,0);
$source =$this->_pdf_vars['yousetui2f'];
$pos = $vPos;
$info = $this->adjustToWidth($source, $wd,'kozgopromedium',12);
$this->SetFont('kozgopromedium', '',$info);
$this->SetXY($hPos, $pos);
$this->Cell($wd,11, $source, 0, 0,'R',0,'',0,0,'T','M');

//罫線設定
$this->Line(3.8, 3.6, 145.5, 3.6, array('width' => 0.6, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(3.8, 10.6, 145.5, 10.6, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(12.8, 10.6, 12.8, 24, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(24.5, 3.6, 24.5, 24, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(83, 3.6, 83, 24, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(94.7, 3.6, 94.7, 24, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(114.9, 3.6, 114.9, 24, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(133.1, 3.6, 133.1, 24, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(3.8, 24, 145.5, 24, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(169.5, 24, 253.5, 24, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(3.8, 27.4, 145.5, 27.4, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(12.8, 31.9, 145.5, 31.9, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(169.5, 31.9, 253.5, 31.9, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(3.8, 39.2, 106.4, 39.2, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(12.8, 43.7, 145.5, 43.7, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(169.5, 24, 169.5, 43.7, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(197.5, 24, 197.5, 43.7, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(225.5, 24, 225.5, 43.7, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(253.5, 24, 253.5, 43.7, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(169.5, 43.7, 253.5, 43.7, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(3.8, 51, 106.4, 51, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(12.8, 55.5, 106.4, 55.5, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(106.4, 55.5, 145.5, 55.5, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(3.8, 62.8, 106.4, 62.8, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(12.8, 67.3, 106.4, 67.3, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(12.8, 27.4, 12.8, 74.6, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(24.5, 27.4, 24.5, 74.6, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(36.2, 27.4, 36.2, 74.6, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(47.9, 27.4, 47.9, 74.6, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(59.6, 27.4, 59.6, 74.6, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(71.3, 27.4, 71.3, 74.6, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(83, 27.4, 83, 74.6, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(94.7, 27.4, 94.7, 74.6, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(106.4, 27.4, 106.4, 74.6, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(114.9, 31.9, 114.9, 74.6, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(3.8, 74.6, 145.5, 74.6, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(3.8, 78, 145.5, 78, array('width' => 0.6, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(3.8, 89, 145.5, 89, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(24.5, 78, 24.5, 100, array('width' => 0.6, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(3.8, 100, 145.5, 100, array('width' => 0.6, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(3.8, 111, 114.9, 111, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 1, 'color' => array(0,0,0)));
$this->Line(114.9, 110.3, 145.5, 110.3, array('width' => 0.1, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(114.9, 111, 145.5, 111, array('width' => 0.1, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(148.5, 111, 211.5, 111, array('width' => 0.6, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,102,255)));
$this->Line(3.8, 122, 114.9, 122, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 1, 'color' => array(0,0,0)));
$this->Line(114.9, 122, 145.5, 122, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(176.5, 111, 176.5, 122, array('width' => 0.6, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,102,255)));
$this->Line(211.5, 111, 211.5, 122, array('width' => 0.6, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,102,255)));
$this->Line(148.5, 122, 292.8, 122, array('width' => 0.6, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,102,255)));
$this->Line(3.8, 133, 114.9, 133, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 1, 'color' => array(0,0,0)));
$this->Line(148.5, 133, 292.8, 133, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,102,255)));
$this->Line(114.9, 100, 114.9, 144.9, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(122.1, 122, 122.1, 144.9, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(3.8, 144.9, 145.5, 144.9, array('width' => 0.6, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(148.5, 144.9, 292.8, 144.9, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,102,255)));
$this->Line(47.9, 144.9, 47.9, 155.9, array('width' => 0.6, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(94.7, 144.9, 94.7, 155.9, array('width' => 0.6, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(3.8, 155.9, 145.5, 155.9, array('width' => 0.6, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(148.5, 111, 148.5, 155.9, array('width' => 0.6, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,102,255)));
$this->Line(176.5, 122, 176.5, 155.9, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,102,255)));
$this->Line(197.5, 122, 197.5, 155.9, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,102,255)));
$this->Line(225.5, 122, 225.5, 155.9, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,102,255)));
$this->Line(246.5, 122, 246.5, 155.9, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,102,255)));
$this->Line(274.5, 122, 274.5, 155.9, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,102,255)));
$this->Line(292.8, 122, 292.8, 155.9, array('width' => 0.6, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,102,255)));
$this->Line(148.5, 155.9, 292.8, 155.9, array('width' => 0.6, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,102,255)));
$this->Line(148.5, 164.1, 211.5, 164.1, array('width' => 0.6, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(255,0,0)));
$this->Line(176.5, 164.1, 176.5, 175.1, array('width' => 0.6, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(255,0,0)));
$this->Line(211.5, 164.1, 211.5, 175.1, array('width' => 0.6, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(255,0,0)));
$this->Line(148.5, 175.1, 292.8, 175.1, array('width' => 0.6, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(255,0,0)));
$this->Line(148.5, 186.1, 292.8, 186.1, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(255,0,0)));
$this->Line(148.5, 197.1, 292.8, 197.1, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(255,0,0)));
$this->Line(3.8, 3.6, 3.8, 208.1, array('width' => 0.6, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(145.5, 3.6, 145.5, 208.1, array('width' => 0.6, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(3.8, 208.1, 145.5, 208.1, array('width' => 0.6, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(0,0,0)));
$this->Line(148.5, 164.1, 148.5, 208.1, array('width' => 0.6, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(255,0,0)));
$this->Line(176.5, 175.1, 176.5, 208.1, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(255,0,0)));
$this->Line(197.5, 175.1, 197.5, 208.1, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(255,0,0)));
$this->Line(225.5, 175.1, 225.5, 208.1, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(255,0,0)));
$this->Line(246.5, 175.1, 246.5, 208.1, array('width' => 0.4, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(255,0,0)));
$this->Line(274.5, 175.1, 274.5, 208.1, array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(255,0,0)));
$this->Line(292.8, 175.1, 292.8, 208.1, array('width' => 0.6, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(255,0,0)));
$this->Line(148.5, 208.1, 292.8, 208.1, array('width' => 0.6, 'cap' => 'butt', 'join' => 'miter','dash' => 0, 'color' => array(255,0,0)));
}
}

?>

 

画像の取り込みやプロポーショナルの対応などまだ課題は残るが、PHPでPDF帳票を出力するには、まあまあ満足できる出来栄えは自画自賛か。

 

【謝辞】

最後に、ジェネレーターの作成に当たり、次のサイトを参考にさせて頂きました。

各サイト作成の皆様ありがとうございました。

TCPDFマニュアル(勝手訳)

TCPDFの部屋

Examples · TCPDF