<% ' 文字を書く ■を描く、枠を描く ' 2007/7/19 if request("gen_go") <> "" then base_font = "fontname=HeiseiKakuGo-W5 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 ' 日付を右下に挿入 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") ' ----- 四角を描く塗りつぶし 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=test.pdf" Response.Addheader "Content-Length", LenB(buf_all) Response.BinaryWrite(buf_all) response.redirect "./out_pdf/" & ymd response.end else %> PDFlib サンプル : 指定位置の文字入力
【文字入力 + 文字位置 移動】 グリーンの部分が移動可能 create_textflow サンプル
ベースのPDFに文字を埋め込む
□ グリーンの部分はマウスでドラッグ移動可能
□ グリーンの部分の右下の矢印で枠の大きさ変更可能
位置 x1 y1 x2 y2 w h
センター
(赤枠内)
1. 文字を入力して、「生成」ボタンをクリック
2.「生成」ボタンをクリック
3.別ウィンドウで生成されたPDFを表示


  

ソース表示

PDFlib サンプルTOP

Spinnen Gilde Ltd.

<% end if %>