#!/usr/local/bin/ruby # # hello.rb # # PDFlib client: hello example in Ruby # require 'pdflib' pdf = PDF.open("hello_rb.pdf") pdf.set_info(PDF::INFO_CREATOR, "hello.rb") pdf.set_info(PDF::INFO_AUTHOR, "TAKAHASHI Hitoshi") pdf.set_info(PDF::INFO_TITLE, "Hello, World (Ruby)!") pdf.begin_page(PDF::A4_WIDTH, PDF::A4_HEIGHT) font = pdf.findfont("Helvetica-Bold", "host", false) pdf.setfont(font, 24) pdf.set_text_pos(50, 700) pdf.show("Hello, world!") pdf.continue_text("(says Ruby)") pdf.end_page pdf.close