<% ' 四角を描く ' 2005/10/28 ' 2007/7/19 if request("gen_go") <> "" then Set oPDF = Server.CreateObject("PDFlib_com.PDF") oPDF.set_info "Creator", "make_rect.asp" oPDF.set_info "Author", "Ko Orii" oPDF.set_info "Title", "PDFlib ichimatsu Test" ymd=replace(replace(replace(now(),"/",""),":","")," ","_") & ".pdf" outfile = server.mappath("./out_pdf") & "\" & ymd oPDF.begin_document outfile , "" infile = server.mappath("./pdfs/ichimatsu.pdf") ichimatsu = oPDF.open_pdi(infile, "", 0) page = oPDF.open_pdi_page(ichimatsu, 1, "") ' topdown : Establish coordinates with the origin in the upper left corner. 左上原点 oPDF.begin_page_ext 595, 842, "topdown" oPDF.fit_pdi_page page, 0, 842, "" oPDF.close_pdi_page page ' ----- 日付を右下に挿入 base_font = "fontname=HeiseiKakuGo-W5 encoding=UniJIS-UCS2-H " date_line = DATE optlist = base_font & " fontsize=10 fillcolor {rgb 0 0 0} " textflow = oPDF.create_textflow(date_line, optlist) oPDF.fit_textflow textflow, 500, 750, 550, 770, "showborder=true" oPDF.delete_textflow textflow ' ----- 四角のいち loc_x1 = request("t_x1") loc_y1 = request("t_y1") loc_x2 = request("t_x2") loc_y2 = request("t_y2") w_px = request("tw_px") h_px = request("th_px") ' ----- 四角を描く if request("c_fill")<>"transparent" then select case request("c_fill") case "#ff0000" : oPDF.setcolor "fill", "rgb", 1,0,0,0 case "#0000ff" : oPDF.setcolor "fill", "rgb", 0,0,1,0 case "#00ff00" : oPDF.setcolor "fill", "rgb", 0,1,0,0 case "#000000" : oPDF.setcolor "fill", "rgb", 0,0,0,0 case "#ffffff" : oPDF.setcolor "fill", "rgb", 1,1,1,0 end select oPDF.rect loc_x1, loc_y2, w_px, h_px oPDF.fill end if ' ----- 四角の枠線 select case request("c_line") case "#ff0000" : oPDF.setcolor "stroke", "rgb", 1,0,0,0 case "#0000ff" : oPDF.setcolor "stroke", "rgb", 0,0,1,0 case "#00ff00" : oPDF.setcolor "stroke", "rgb", 0,1,0,0 case "#000000" : oPDF.setcolor "stroke", "rgb", 0,0,0,0 case "#ffffff" : oPDF.setcolor "stroke", "rgb", 1,1,1,0 end select oPDF.setlinewidth request("w_line") if request("t_line") = "dashed" then oPDF.setdash 8+request("w_line"),3+request("w_line") end if oPDF.rect loc_x1, loc_y2, w_px, h_px oPDF.stroke oPDF.end_page_ext "" oPDF.end_document "" oPDF.close_pdi ichimatsu On Error Resume Next buf_all = oPDF.get_buffer() Set oPDF = nothing response.redirect "./out_pdf/" & ymd response.end else %> PDFlib サンプル : 指定位置の文字入力
【四角を描く】 グリーンの部分が移動可能 create_textflow サンプル
位置 x1 y1
x2 y2
太さ

線種
線色  
 
 
塗り色  
 
 



  

ソース表示

PDFlib サンプルTOP

Spinnen Gilde Ltd.

. <% end if %>