<%@ LANGUAGE = VBScript %> <% ' 文字を書く ■を描く、枠を描く ' 2005/9/8 response.write request("gen_go") if request("gen_go") <> "" then base_font = "fontname=HeiseiKakuGo-W5 encoding=UniJIS-UCS2-H " ' base_font = "fontname=HeiseiMin-W3 encoding=UniJIS-UCS2-H " optlist0 = base_font & " fontsize=10 " Set oPDF = Server.CreateObject("PDFlib_com.PDF") oPDF.set_info "Creator", "lay_moji.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 ' regularfont = oPDF.load_font("HeiseiKakuGo-W5", "UniJIS-UCS2-H", "") regularfont = oPDF.findfont("HeiseiKakuGo-W5", "UniJIS-UCS2-H", 0) leading = 20 ' leading : 行間 oPDF.setfont regularfont, 20 oPDF.set_value "leading", leading oPDF.show_xy request("txt1"), 500, 20 oPDF.continue_text request("txt2") oPDF.continue_text request("txt3") 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 leading = 15 for kk = 1 to 10 y = kk*leading+10 oPDF.setfont regularfont, 12 buf = kk & "-" & y & ":,x 300" oPDF.fit_textline buf, 400, y, "position {0 0}" ' Print the closing text with the textflow feature next lline = "左下色違い " textflow = oPDF.create_textflow(lline, optlist0) oPDF.fit_textflow textflow, 10, 800, 100, 750, "showborder=true" oPDF.delete_textflow textflow ltxt = "" & request("1txt1") &_ vbcrlf & "" & request("1txt2") &_ vbcrlf & "" & request("1txt3") &_ vbcrlf & "" & request("1txt4") &_ vbcrlf & "" & request("1txt5") &_ vbcrlf & "" & request("1txt6") oPDF.setcolor "fill", "rgb", 1,1,0, 0 oPDF.rect 100,200, 100,150 oPDF.fill textflow = oPDF.create_textflow(ltxt, optlist0) oPDF.fit_textflow textflow, 100, 200, 200, 50, "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") ' ----- 四角を描く oPDF.setcolor "fill", "rgb", 0, 1, 0, 0 oPDF.rect loc_x1, loc_y2, w_px, h_px oPDF.fill ' ----- 四角の枠線の色指定 oPDF.setcolor "stroke", "rgb", 1,0,0, 0 oPDF.rect loc_x1, loc_y2, w_px, h_px oPDF.fill center_txt = replace(request("center_txt"),Chr(13)+Chr(10),vbcrlf) optlist = base_font & " fontsize=20 fillcolor {rgb 0 0 0} " textflow = oPDF.create_textflow(center_txt, optlist) oPDF.fit_textflow textflow, loc_x1,loc_y1, loc_x2,loc_y2, "showborder=true" oPDF.delete_textflow textflow oPDF.end_page_ext "" oPDF.end_document "" oPDF.close_pdi ichimatsu On Error Resume Next buf_all = oPDF.get_buffer() Set oPDF = nothing Response.Expires = 0 Response.Buffer = true Response.ContentType = "application/pdf" Response.Addheader "Content-Disposition", "inline; filename=" & "hello.pdf" Response.Addheader "Content-Length", LenB(buf_all) Response.BinaryWrite(buf_all) else %> PDFlib サンプル
【文字入力 + 文字位置 移動】 グリーンの部分が移動可能 create_textflow サンプル
位置 x1 y1 x2 y2 w h
センター
(赤枠内)
左上 黒
左上 赤
左上 緑
左上 青
左上 白
左上 黒
txt1 txt2 txt3
     

Spinnen Gilde Ltd.

<% end if response.write "ok" %>