Changeset 15078 for branches/feature-module-update/data/class/SC_Pdf.php
- Timestamp:
- 2007/07/20 15:58:59 (19 years ago)
- Location:
- branches/feature-module-update
- Files:
-
- 1 edited
- 2 copied
-
. (copied) (copied from branches/rel) (1 prop)
-
data (copied) (copied from branches/rel/data)
-
data/class/SC_Pdf.php (modified) (37 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/feature-module-update
-
Property
svn:ignore
set to
.cache
.settings
.projectOptions
-
Property
svn:ignore
set to
-
branches/feature-module-update/data/class/SC_Pdf.php
r12157 r15078 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.
