Sha256: 5224af58ec3de1ea0a22d6bbf0186109331a3309cd261ad4ce956605d5aafaf3

Contents?: true

Size: 679 Bytes

Versions: 4

Compression:

Stored size: 679 Bytes

Contents

require File.dirname(__FILE__) + "/../../node/base"
require "PDFlib"
module FN
  module PDF
    module Node
      
      def Watermark(text)
        FN::Node::Base("watermark", :text => text).extend(Watermark)
      end
      
      module Watermark
        include FN::Node::Base
      
        def visit(struct)
          has_no_children
          w = struct[CURRENT_PAGE_WIDTH]
          h = struct[CURRENT_PAGE_HEIGHT]
          font = struct.load_font("Arial,Bold", "unicode", "")
          struct.fit_textline(self["text"], 0, h, "font #{font} fontsize 30 boxsize {#{w} #{h}} fitmethod meet rotate 0 textrendering 1 position {0 50}")
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fn_document-0.9.6 lib/fn/pdf/node/watermark.rb
fn_document-0.9.4 lib/fn/pdf/node/watermark.rb
fn_document-0.9.3 lib/fn/pdf/node/watermark.rb
fn_document-0.9.2 lib/fn/pdf/node/watermark.rb