Changeset 11730 for branches/comu/data/class/SC_Pdf.php
- Timestamp:
- 2007/03/11 06:27:25 (19 years ago)
- File:
-
- 1 edited
-
branches/comu/data/class/SC_Pdf.php (modified) (37 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/comu/data/class/SC_Pdf.php
r11729 r11730 7 7 8 8 /*---------------------------------------------------------------------- 9 * [ 名称] GC_Pdf10 * [ 概要] Pdfファイルを表示する。(PDFLib必須)9 * [̾¾Î] GC_Pdf 10 * [³µÍ×] Pdf¥Õ¥¡¥¤¥ë¤òɽ¼¨¤¹¤ë¡£(PDFLibɬ¿Ü) 11 11 *---------------------------------------------------------------------- 12 12 */ 13 13 14 // グリッドと文字の間隔14 // ¥°¥ê¥Ã¥É¤Èʸ»ú¤Î´Ö³Ö 15 15 define("GRID_SPACE", 4); 16 16 … … 29 29 $this->license_key = "B600602-010400-714251-5851C1"; 30 30 $this->src_code = CHAR_CODE; 31 // UTF-8 でないとブロック内で改行できない。31 // UTF-8¤Ç¤Ê¤¤¤È¥Ö¥í¥Ã¥¯Æâ¤Ç²þ¹Ô¤Ç¤¤Ê¤¤¡£ 32 32 $this->dst_code = "UTF-8"; 33 // PDF BLOCK のプロパティ33 // PDF BLOCK¤Î¥×¥í¥Ñ¥Æ¥£ 34 34 $this->block_option = "encoding=UniJIS-UCS2-H textformat=utf8 fontname=HeiseiMin-W3 textflow=true"; 35 // 警告表示35 // ·Ù¹ðɽ¼¨ 36 36 $this->pdiwarning = "true"; 37 // ページサイズ設定37 // ¥Ú¡¼¥¸¥µ¥¤¥ºÀßÄê 38 38 $this->width = $width; 39 39 $this->height = $height; 40 // PDF 初期化40 // PDF½é´ü²½ 41 41 $this->pdf = PDF_new(); 42 42 PDF_set_parameter($this->pdf, "license", $this->license_key); 43 43 PDF_set_parameter($this->pdf, "pdiwarning", $this->pdiwarning); 44 // ドキュメント開始44 // ¥É¥¥å¥á¥ó¥È³«»Ï 45 45 PDF_begin_document($this->pdf, NULL, NULL); 46 // ページの状態46 // ¥Ú¡¼¥¸¤Î¾õÂÖ 47 47 $this->page_open = false; 48 // テーブルの色設定48 // ¥Æ¡¼¥Ö¥ë¤Î¿§ÀßÄê 49 49 $this->setTableColor(); 50 // フォントサイズの設定50 // ¥Õ¥©¥ó¥È¥µ¥¤¥º¤ÎÀßÄê 51 51 $this->fontsize = $fontsize; 52 // グリッド描画の特殊指定52 // ¥°¥ê¥Ã¥ÉÉÁ²è¤ÎÆÃ¼ì»ØÄê 53 53 $this->arrLines = array(); 54 // テーブルタイトルのスタイル54 // ¥Æ¡¼¥Ö¥ë¥¿¥¤¥È¥ë¤Î¥¹¥¿¥¤¥ë 55 55 $this->arrHeaderColSize = array(); 56 56 $this->arrHeaderAlign = array(); 57 // テーブル補正値57 // ¥Æ¡¼¥Ö¥ëÊäÀµÃÍ 58 58 $this->table_left = 0; 59 // タイトル行の出力59 // ¥¿¥¤¥È¥ë¹Ô¤Î½ÐÎÏ 60 60 $this->title_enable = true; 61 // グリッドの出力61 // ¥°¥ê¥Ã¥É¤Î½ÐÎÏ 62 62 $this->grid_enable = true; 63 63 } 64 64 65 // タイトルを出力するか否か65 // ¥¿¥¤¥È¥ë¤ò½ÐÎϤ¹¤ë¤«Èݤ« 66 66 function setTitleEnable($flag) { 67 67 $this->title_enable = $flag; 68 68 } 69 69 70 // グリッドを出力するか否か70 // ¥°¥ê¥Ã¥É¤ò½ÐÎϤ¹¤ë¤«Èݤ« 71 71 function setGridEnable($flag) { 72 72 $this->grid_enable = $flag; … … 74 74 75 75 76 // キー:ブロック名、値:表示テキストのハッシュ配列をセットする。76 // ¥¡¼¡§¥Ö¥í¥Ã¥¯Ì¾¡¢ÃÍ¡§É½¼¨¥Æ¥¥¹¥È¤Î¥Ï¥Ã¥·¥åÇÛÎó¤ò¥»¥Ã¥È¤¹¤ë¡£ 77 77 function setTextBlock($list) { 78 78 unset($this->arrText); … … 80 80 } 81 81 82 // キー:ブロック名、値:ファイルパスのハッシュ配列をセットする。83 // ※パスはドキュメントルート以下82 // ¥¡¼¡§¥Ö¥í¥Ã¥¯Ì¾¡¢ÃÍ¡§¥Õ¥¡¥¤¥ë¥Ñ¥¹¤Î¥Ï¥Ã¥·¥åÇÛÎó¤ò¥»¥Ã¥È¤¹¤ë¡£ 83 // ¢¨¥Ñ¥¹¤Ï¥É¥¥å¥á¥ó¥È¥ë¡¼¥È°Ê²¼ 84 84 function setImageBlock($list) { 85 85 unset($this->arrImage); … … 87 87 } 88 88 89 // 表示背景となるテンプレートファイルパス90 // ※パスはドキュメントルート以下89 // ɽ¼¨ÇØ·Ê¤È¤Ê¤ë¥Æ¥ó¥×¥ì¡¼¥È¥Õ¥¡¥¤¥ë¥Ñ¥¹ 90 // ¢¨¥Ñ¥¹¤Ï¥É¥¥å¥á¥ó¥È¥ë¡¼¥È°Ê²¼ 91 91 function setTemplate($pdfpath) { 92 92 if(file_exists($pdfpath)) { 93 93 $this->pdfpath = $pdfpath; 94 94 } else { 95 print(" 指定したPDFテンプレートは存在しません:".$pdfpath);95 print("»ØÄꤷ¤¿PDF¥Æ¥ó¥×¥ì¡¼¥È¤Ï¸ºß¤·¤Þ¤»¤ó¡§".$pdfpath); 96 96 exit; 97 97 } 98 98 } 99 99 100 // テーブル位置補正値100 // ¥Æ¡¼¥Ö¥ë°ÌÃÖÊäÀµÃÍ 101 101 function setTableLeft($table_left) { 102 102 $this->table_left = $table_left; 103 103 } 104 104 105 // グリッド描画の特殊指定105 // ¥°¥ê¥Ã¥ÉÉÁ²è¤ÎÆÃ¼ì»ØÄê 106 106 function setGridLines($list) { 107 107 $this->arrLines = $list; 108 108 } 109 109 110 // テーブルタイトルのスタイル設定110 // ¥Æ¡¼¥Ö¥ë¥¿¥¤¥È¥ë¤Î¥¹¥¿¥¤¥ëÀßÄê 111 111 function setTableHeaderStyle($arrColSize, $arrAlign) { 112 112 $this->arrHeaderColSize = $arrColSize; … … 114 114 } 115 115 116 // ブロックデータの書き込み(closeすると次回新規ページ)116 // ¥Ö¥í¥Ã¥¯¥Ç¡¼¥¿¤Î½ñ¤¹þ¤ß(close¤¹¤ë¤È¼¡²ó¿·µ¬¥Ú¡¼¥¸) 117 117 function writeBlock() { 118 // テンプレートを使用する118 // ¥Æ¥ó¥×¥ì¡¼¥È¤ò»ÈÍѤ¹¤ë 119 119 if(!file_exists($this->pdfpath)) { 120 120 return; 121 121 } 122 // 既存PDFのドキュメントを取得122 // ´û¸PDF¤Î¥É¥¥å¥á¥ó¥È¤ò¼èÆÀ 123 123 $doc = pdf_open_pdi($this->pdf, $this->pdfpath, NULL, 0 ); 124 // 既存PDFのドキュメントから指定ページを取得124 // ´û¸PDF¤Î¥É¥¥å¥á¥ó¥È¤«¤é»ØÄê¥Ú¡¼¥¸¤ò¼èÆÀ 125 125 $page = pdf_open_pdi_page($this->pdf, $doc, 1, NULL ); 126 // ページを開く126 // ¥Ú¡¼¥¸¤ò³«¤¯ 127 127 $this->openPage(); 128 128 129 // 既存PDFのページを割り当てる129 // ´û¸PDF¤Î¥Ú¡¼¥¸¤ò³ä¤êÅö¤Æ¤ë 130 130 PDF_fit_pdi_page($this->pdf, $page, 0, 0, "adjustpage"); 131 131 132 // テキストブロックの書き込み132 // ¥Æ¥¥¹¥È¥Ö¥í¥Ã¥¯¤Î½ñ¤¹þ¤ß 133 133 $max = count($this->arrText); 134 134 for($i = 0;$i < $max; $i++) { 135 135 foreach($this->arrText[$i] as $key => $val) { 136 136 if($val != "") { 137 // 文字コードの変換137 // ʸ»ú¥³¡¼¥É¤ÎÊÑ´¹ 138 138 mb_convert_variables($this->dst_code, $this->src_code, $val); 139 // 書き込み139 // ½ñ¤¹þ¤ß 140 140 $ret = PDF_fill_textblock($this->pdf, $page, $key, $val, $this->block_option); 141 141 } … … 143 143 } 144 144 145 // イメージブロックの書き込み145 // ¥¤¥á¡¼¥¸¥Ö¥í¥Ã¥¯¤Î½ñ¤¹þ¤ß 146 146 $max = count($this->arrImage); 147 147 for($i = 0;$i < $max; $i++) { … … 154 154 } 155 155 156 // 割り当てたページを閉じる156 // ³ä¤êÅö¤Æ¤¿¥Ú¡¼¥¸¤òÊĤ¸¤ë 157 157 PDF_close_pdi_page($this->pdf, $page); 158 // 割り当てたドキュメントを閉じる158 // ³ä¤êÅö¤Æ¤¿¥É¥¥å¥á¥ó¥È¤òÊĤ¸¤ë 159 159 PDF_close_pdi($this->pdf, $doc); 160 160 } 161 161 162 // ページを閉じる162 // ¥Ú¡¼¥¸¤òÊĤ¸¤ë 163 163 function closePage() { 164 164 if($this->page_open) { 165 // ページを閉じる165 // ¥Ú¡¼¥¸¤òÊĤ¸¤ë 166 166 PDF_end_page_ext($this->pdf, NULL); 167 167 $this->page_open = false; … … 169 169 } 170 170 171 // ページを開く171 // ¥Ú¡¼¥¸¤ò³«¤¯ 172 172 function openPage() { 173 173 if(!$this->page_open) { 174 // 新しいページを開く174 // ¿·¤·¤¤¥Ú¡¼¥¸¤ò³«¤¯ 175 175 PDF_begin_page_ext($this->pdf, $this->width, $this->height, NULL); 176 176 $this->page_open = true; … … 178 178 } 179 179 180 // 新しいページを開く180 // ¿·¤·¤¤¥Ú¡¼¥¸¤ò³«¤¯ 181 181 function newPage() { 182 182 PDF_end_page_ext($this->pdf, NULL); … … 184 184 } 185 185 186 // アクティブなページのサイズを取得する186 // ¥¢¥¯¥Æ¥£¥Ö¤Ê¥Ú¡¼¥¸¤Î¥µ¥¤¥º¤ò¼èÆÀ¤¹¤ë 187 187 function getSize() { 188 188 $this->openPage(); … … 192 192 } 193 193 194 // 座標を入れ替えて取得する(左下(0,0)を左上(0,0)に変換)194 // ºÂɸ¤òÆþ¤ìÂØ¤¨¤Æ¼èÆÀ¤¹¤ë(º¸²¼(0,0)¤òº¸¾å(0,0)¤ËÊÑ´¹) 195 195 function posTopDown($x, $y) { 196 196 $width = 0; 197 197 $height = 0; 198 198 list($width, $height) = $this->getSize(); 199 // x 座標は、変更の必要なし199 // xºÂɸ¤Ï¡¢Êѹ¹¤ÎɬÍפʤ· 200 200 $pdf_x = $x; 201 201 $pdf_y = $height - $y; … … 203 203 } 204 204 205 // テーブルカラーの設定205 // ¥Æ¡¼¥Ö¥ë¥«¥é¡¼¤ÎÀßÄê 206 206 function setTableColor($frame_color = "000000", $title_color = "F0F0F0", $line_color = "D1DEFE", $last_color = "FDCBFE") { 207 207 $this->frame_color = $frame_color; … … 211 211 } 212 212 213 // テーブルのグリッドを表示する。213 // ¥Æ¡¼¥Ö¥ë¤Î¥°¥ê¥Ã¥É¤òɽ¼¨¤¹¤ë¡£ 214 214 function writeGrid($x, $y, $arrCol, $line_max, $last_color_flg = true) { 215 // テーブル幅215 // ¥Æ¡¼¥Ö¥ëÉý 216 216 $max = count($arrCol); 217 217 $width = 0; … … 221 221 222 222 if($this->title_enable) { 223 // タイトルグリッド描画223 // ¥¿¥¤¥È¥ë¥°¥ê¥Ã¥ÉÉÁ²è 224 224 $this->writeFrameRect($x, $y + GRID_SPACE, $width + GRID_SPACE, $this->fontsize + GRID_SPACE, $this->title_color, $this->frame_color); 225 225 } 226 226 227 // グリッド特殊指定あり227 // ¥°¥ê¥Ã¥ÉÆÃ¼ì»ØÄꤢ¤ê 228 228 if(count($this->arrLines) > 0) { 229 229 $count = count($this->arrLines); … … 231 231 for($i = 0; $i < $count; $i++) { 232 232 if(($i % 2) != 0) { 233 // 行の間隔233 // ¹Ô¤Î´Ö³Ö 234 234 $down = ($pos + 1) * $this->fontsize * 1.5; 235 // 描画する縦幅を求める235 // ÉÁ²è¤¹¤ë½ÄÉý¤òµá¤á¤ë 236 236 $height = ($this->fontsize + GRID_SPACE) * $this->arrLines[$i] + ($this->arrLines[$i] - 1); 237 // 行グリッド描画237 // ¹Ô¥°¥ê¥Ã¥ÉÉÁ²è 238 238 $this->writeRect($x, $y + GRID_SPACE + $down, $width + GRID_SPACE, $height, $this->line_color); 239 239 } … … 243 243 for($i = 1; $i <= $line_max; $i++) { 244 244 if(($i % 2) == 0) { 245 // 行の間隔245 // ¹Ô¤Î´Ö³Ö 246 246 $down = $i * $this->fontsize * 1.5; 247 // 行グリッド描画247 // ¹Ô¥°¥ê¥Ã¥ÉÉÁ²è 248 248 $this->writeRect($x, $y + GRID_SPACE + $down, $width + GRID_SPACE, $this->fontsize + GRID_SPACE, $this->line_color); 249 249 } 250 250 } 251 // 最終行に色をつける場合251 // ºÇ½ª¹Ô¤Ë¿§¤ò¤Ä¤±¤ë¾ì¹ç 252 252 if($last_color_flg) { 253 // 行の間隔253 // ¹Ô¤Î´Ö³Ö 254 254 $down = $line_max * $this->fontsize * 1.5; 255 // 行グリッド描画255 // ¹Ô¥°¥ê¥Ã¥ÉÉÁ²è 256 256 $this->writeRect($x, $y + GRID_SPACE + $down, $width + GRID_SPACE, $this->fontsize + GRID_SPACE, $this->last_color); 257 257 } … … 259 259 } 260 260 261 // グリッド用のアンダーラインを引く261 // ¥°¥ê¥Ã¥ÉÍѤΥ¢¥ó¥À¡¼¥é¥¤¥ó¤ò°ú¤¯ 262 262 /* 263 $x : テーブル開始位置X軸264 $y : テーブル開始位置Y軸265 $arrCol : カラムサイズの配列266 $line : アンダーラインを引く行267 $start_col : アンダーライン開始カラム(0:開始カラム)263 $x :¥Æ¡¼¥Ö¥ë³«»Ï°ÌÃÖX¼´ 264 $y :¥Æ¡¼¥Ö¥ë³«»Ï°ÌÃÖY¼´ 265 $arrCol :¥«¥é¥à¥µ¥¤¥º¤ÎÇÛÎó 266 $line :¥¢¥ó¥À¡¼¥é¥¤¥ó¤ò°ú¤¯¹Ô 267 $start_col :¥¢¥ó¥À¡¼¥é¥¤¥ó³«»Ï¥«¥é¥à(0:³«»Ï¥«¥é¥à) 268 268 */ 269 269 function writeUnderLine($x, $y, $arrCol, $line, $start_col = 0) { 270 // テーブル幅270 // ¥Æ¡¼¥Ö¥ëÉý 271 271 $max = count($arrCol); 272 272 $width = 0; … … 280 280 } 281 281 282 // アンダーラインのY座標を求める282 // ¥¢¥ó¥À¡¼¥é¥¤¥ó¤ÎYºÂɸ¤òµá¤á¤ë 283 283 $down = ($line + 1) * $this->fontsize * 1.5; 284 // 行グリッド描画284 // ¹Ô¥°¥ê¥Ã¥ÉÉÁ²è 285 285 $sx = $x + $start_x + GRID_SPACE + $this->table_left; 286 286 $sy = $y + GRID_SPACE + $down - 1; … … 291 291 } 292 292 293 // 真ん中横位置を求める293 // ¿¿¤óÃæ²£°ÌÃÖ¤òµá¤á¤ë 294 294 function getXCenter($width) { 295 295 $page_width = 0; … … 300 300 } 301 301 302 // 自動中央よせ302 // ¼«Æ°Ãæ±û¤è¤» 303 303 function writeTableCenter($table, $y, $arrCol, $arrAlign, $line_max = 256, $start_no = 1, $last_color_flg = false) { 304 // テーブルサイズ取得304 // ¥Æ¡¼¥Ö¥ë¥µ¥¤¥º¼èÆÀ 305 305 $width = 0; 306 306 foreach($arrCol as $val) { 307 307 $width += $val; 308 308 } 309 // 中央よせ位置取得309 // Ãæ±û¤è¤»°ÌÃÖ¼èÆÀ 310 310 $x = $this->getXCenter($width) + $this->table_left; 311 311 list($ret_x, $ret_y) = $this->writeTable($table, $x, $y, $arrCol, $arrAlign, $line_max, $start_no, $last_color_flg); 312 // X 軸の座標を返す312 // X¼´¤ÎºÂɸ¤òÊÖ¤¹ 313 313 return array($ret_x, $ret_y); 314 314 } 315 315 316 // データの書き込み(closeすると次回新規ページ)317 // $start_no:1 行目(タイトル)を0とする。318 // $line_max: タイトルを含まない行数316 // ¥Ç¡¼¥¿¤Î½ñ¤¹þ¤ß(close¤¹¤ë¤È¼¡²ó¿·µ¬¥Ú¡¼¥¸) 317 // $start_no:1¹ÔÌÜ(¥¿¥¤¥È¥ë)¤ò0¤È¤¹¤ë¡£ 318 // $line_max:¥¿¥¤¥È¥ë¤ò´Þ¤Þ¤Ê¤¤¹Ô¿ô 319 319 function writeTable($table, $x, $y, $arrCol, $arrAlign, $line_max = 256, $start_no = 1, $last_color_flg = false) { 320 320 $this->openPage(); … … 328 328 } 329 329 330 // タイトル有効330 // ¥¿¥¤¥È¥ë͸ú 331 331 if($this->grid_enable) { 332 // グリッドの描画332 // ¥°¥ê¥Ã¥É¤ÎÉÁ²è 333 333 $this->writeGrid($x, $y, $arrCol, $line_max, $last_color_flg); 334 334 } 335 335 336 // Unicode エンコーディングとしてUTF-8を設定336 // Unicode¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°¤È¤·¤ÆUTF-8¤òÀßÄê 337 337 PDF_set_parameter($this->pdf, "textformat", "utf8"); 338 338 339 // タイトル有効339 // ¥¿¥¤¥È¥ë͸ú 340 340 if($this->title_enable) { 341 341 if(count($this->arrHeaderColSize) > 0 && count($this->arrHeaderAlign) > 0 ) { … … 345 345 } 346 346 347 // タイトル行の書き込み347 // ¥¿¥¤¥È¥ë¹Ô¤Î½ñ¤¹þ¤ß 348 348 $option = "ruler {" . $linecol . "} "; 349 349 $option.= "tabalignment {" . $aligncol . "} "; … … 356 356 list($linecol, $aligncol, $width) = $this->getTableOption($arrCol, $arrAlign); 357 357 358 // データ行の書き込み358 // ¥Ç¡¼¥¿¹Ô¤Î½ñ¤¹þ¤ß 359 359 $option = "ruler {" . $linecol . "} "; 360 360 $option.= "tabalignment {" . $aligncol . "} "; … … 376 376 377 377 function getTableOption($arrCol, $arrAlign) { 378 // カラムサイズ378 // ¥«¥é¥à¥µ¥¤¥º 379 379 $max = count($arrCol); 380 380 $width = 0; … … 384 384 } 385 385 386 // カラム位置386 // ¥«¥é¥à°ÌÃÖ 387 387 $max = count($arrAlign); 388 388 for($i = 0; $i < $max; $i++) { … … 393 393 } 394 394 395 // テーブルデータの書き込み395 // ¥Æ¡¼¥Ö¥ë¥Ç¡¼¥¿¤Î½ñ¤¹þ¤ß 396 396 function writeTableData($table, $x, $y, $table_width, $start_no, $end_no, $option) { 397 397 $arrLine = split("\n", $table); … … 400 400 } 401 401 402 // テーブル位置を求める402 // ¥Æ¡¼¥Ö¥ë°ÌÃÖ¤òµá¤á¤ë 403 403 list($pdf_x, $pdf_y) = $this->posTopDown($x, $y); 404 404 405 // テーブル高さを求める405 // ¥Æ¡¼¥Ö¥ë¹â¤µ¤òµá¤á¤ë 406 406 $table_height = $this->fontsize * 1.5 * ($end_no - $start_no + 1); 407 // テーブル右下のy座標を求める407 // ¥Æ¡¼¥Ö¥ë±¦²¼¤ÎyºÂɸ¤òµá¤á¤ë 408 408 $end_y = $pdf_y - $table_height; 409 409 if($end_y < 0) { … … 417 417 PDF_delete_textflow($this->pdf, $tf); 418 418 419 // テーブル左下座標を返す419 // ¥Æ¡¼¥Ö¥ëº¸²¼ºÂɸ¤òÊÖ¤¹ 420 420 return array($x, $y + $table_height); 421 421 } 422 422 423 // 色の設定423 // ¿§¤ÎÀßÄê 424 424 function setColor($rgb) { 425 425 if($rgb != "") { … … 429 429 } 430 430 431 // 短形を描画431 // û·Á¤òÉÁ²è 432 432 function writeRect($x, $y, $width, $height, $rgb = "") { 433 433 $this->openPage(); … … 438 438 } 439 439 440 // 枠付の短形を描画440 // ÏÈÉÕ¤Îû·Á¤òÉÁ²è 441 441 function writeFrameRect($x, $y, $width, $height, $rgb, $frgb) { 442 442 $this->openPage(); … … 451 451 } 452 452 453 // 直線を描画453 // ľÀþ¤òÉÁ²è 454 454 function writeLine($sx, $sy, $ex, $ey, $rgb = "000000") { 455 455 $this->openPage(); … … 463 463 } 464 464 465 // ファイルのダウンロード465 // ¥Õ¥¡¥¤¥ë¤Î¥À¥¦¥ó¥í¡¼¥É 466 466 function output($filekey = "") { 467 467 if(isset($this->pdf)) { 468 // ページを閉じる468 // ¥Ú¡¼¥¸¤òÊĤ¸¤ë 469 469 $this->closePage(); 470 // PDF の終了470 // PDF¤Î½ªÎ» 471 471 PDF_end_document($this->pdf, NULL); 472 // 出力用データの取得472 // ½ÐÎÏÍѥǡ¼¥¿¤Î¼èÆÀ 473 473 $buf = PDF_get_buffer($this->pdf); 474 474 $filename = $filekey . date("ymdHis").".pdf"; … … 478 478 479 479 /* 480 * session_start() を事前に呼び出している場合に出力される以下のヘッダは、481 * URL 直接呼び出し時にエラーを発生させるので空にしておく。480 * session_start()¤ò»öÁ°¤Ë¸Æ¤Ó½Ð¤·¤Æ¤¤¤ë¾ì¹ç¤Ë½ÐÎϤµ¤ì¤ë°Ê²¼¤Î¥Ø¥Ã¥À¤Ï¡¢ 481 * URLľÀܸƤӽФ·»þ¤Ë¥¨¥é¡¼¤òȯÀ¸¤µ¤»¤ë¤Î¤Ç¶õ¤Ë¤·¤Æ¤ª¤¯¡£ 482 482 * 483 483 * Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 … … 489 489 print $buf; 490 490 491 // PDF 解放491 // PDF²òÊü 492 492 PDF_delete($this->pdf); 493 493 } else { 494 print("PDF が生成されていません。");494 print("PDF¤¬À¸À®¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£"); 495 495 } 496 496 exit; 497 497 } 498 498 499 // ファイルの表示499 // ¥Õ¥¡¥¤¥ë¤Îɽ¼¨ 500 500 function display() { 501 501 if(isset($this->pdf)) { 502 // ページを閉じる502 // ¥Ú¡¼¥¸¤òÊĤ¸¤ë 503 503 $this->closePage(); 504 // PDF の終了504 // PDF¤Î½ªÎ» 505 505 PDF_end_document($this->pdf, NULL); 506 506 507 // 出力用データの取得507 // ½ÐÎÏÍѥǡ¼¥¿¤Î¼èÆÀ 508 508 $buf = PDF_get_buffer($this->pdf); 509 509 $len = strlen($buf); … … 513 513 514 514 /* 515 * session_start() を事前に呼び出している場合に出力される以下のヘッダは、516 * URL 直接呼び出し時にエラーを発生させるので空にしておく。515 * session_start()¤ò»öÁ°¤Ë¸Æ¤Ó½Ð¤·¤Æ¤¤¤ë¾ì¹ç¤Ë½ÐÎϤµ¤ì¤ë°Ê²¼¤Î¥Ø¥Ã¥À¤Ï¡¢ 516 * URLľÀܸƤӽФ·»þ¤Ë¥¨¥é¡¼¤òȯÀ¸¤µ¤»¤ë¤Î¤Ç¶õ¤Ë¤·¤Æ¤ª¤¯¡£ 517 517 * 518 518 * Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 … … 524 524 print $buf; 525 525 526 // PDF 解放526 // PDF²òÊü 527 527 PDF_delete($this->pdf); 528 528 } else { 529 print("PDF が生成されていません。");529 print("PDF¤¬À¸À®¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£"); 530 530 } 531 531 exit;
Note: See TracChangeset
for help on using the changeset viewer.
