set_option("errorpolicy=return"); $p->set_option("stringformat=utf8"); $p->set_option("searchpath={" . $searchpath . "}"); if ($p->begin_document($outfile, "") == 0) throw new Exception("Error: " . $p->get_errmsg()); $p->set_info("Creator", "PDFlib Cookbook"); $p->set_info("Title", $title); $font = $p->load_font("Helvetica", "winansi", ""); if ($font == 0) throw new Exception("Error: " . $p->get_errmsg()); /* ページを始める */ $p->begin_page_ext(0, 0, " width=a4.width height=a4.height"); /* 複数行テキストフィールド( フィールド名"comment")を作成する * (multiline=true). * テキストがフィールドの外にスクロールすることはできません * (scrollable=false). * ツールヒントを定義する(tooltip={Enter a comment}). */ $optlist = "backgroundcolor={rgb 0.95 0.95 1} bordercolor={gray 0} " . "currentvalue={Enter a multiline comment} multiline=true " . "scrollable=false tooltip={Enter a comment} font =" . $font . " fontsize=14"; $p->create_field($llx, $lly, $llx + $width, $lly + $height, "comment", "textfield", $optlist); $p->setfont($font, 12); $p->fit_textline("Multiline text field; a tooltip is provided.", $llx, $lly-=30, ""); $p->fit_textline("Text is not allowed to scroll out of the window.", $llx, $lly-=20, ""); $p->end_page_ext(""); $p->end_document(""); $buf = $p->get_buffer(); $len = strlen($buf); header("Content-type: application/pdf"); header("Content-Length: $len"); header("Content-Disposition: inline; filename=form_multiline_textfield.pdf"); print $buf; } catch (PDFlibException $e) { echo("PDFlib exception occurred:\n". "[" . $e->get_errnum() . "] " . $e->get_apiname() . ": " . $e->get_errmsg() . "\n"); exit(1); } catch (Exception $e) { echo($e->getMessage()); exit(1); } $p = 0; ?>