12
12

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

PDF改変に特化したライブラリOrigamiを使ってみる

Posted at

インストール

term
$ gem install origami

Hello world.

以下のコードを hello.rb などとして保存する。

hello.rb
require "origami"

include Origami

contents = ContentStream.new
contents.write "Hello, Origami world.", :x => 0, :y => 0, :rendering => Text::Rendering::STROKE, :size => 50 

page = Page.new
page.setContents(contents)

pdf = PDF.new
pdf.append_page(page)
pdf.save("hello.pdf")

上記のコードを実行すると、hello.pdf がカレントディレクトリに出力されるので開くと、以下のようなPDFとなっている。

結果

リンク

12
12
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12
12

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?