new (PDF::Writer)

         # File lib/pdf/writer.rb, line 325
    325:   def initialize(options = {})
    326:     paper       = options[:paper] || "LETTER"
    327:     orientation = options[:orientation] || :portrait
    328:     version     = options[:version] || PDF_VERSION_13
    329:
    330:     @mutex = Mutex.new
    331:     @current_id = @current_font_id = 0
    332:
    333:       # Start the document
    334:     @objects              = []
    335:     @callbacks            = []
    336:     @font_families        = {}
    337:     @fonts                = {}
    338:     @stack                = []
    339:     @state_stack          = StateStack.new
    340:     @loose_objects        = []
    341:     @current_text_state   = ""
    342:     @options              = {}
    343:     @destinations         = {}
    344:     @add_loose_objects    = {}
    345:     @images               = []
    346:     @word_space_adjust    = nil
    347:     @current_stroke_style = PDF::Writer::StrokeStyle.new(1)
    348:     @page_numbering       = nil
    349:     @arc4                 = nil
    350:     @encryption           = nil
    351:     @file_identifier      = nil
    352:
    353:     @columns              = {}
    354:     @columns_on           = false
    355:     @insert_mode          = nil
    356:
    357:     @catalog  = PDF::Writer::Object::Catalog.new(self)
    358:     @outlines = PDF::Writer::Object::Outlines.new(self)
    359:     @pages    = PDF::Writer::Object::Pages.new(self)
    360:
    361:     @current_node       = @pages
    362:     @procset  = PDF::Writer::Object::Procset.new(self)
    363:     @info     = PDF::Writer::Object::Info.new(self)
    364:     @page     = PDF::Writer::Object::Page.new(self)
    365:     @current_text_render_style  = 0
    366:     @first_page     = @page
    367:
    368:     @version        = version
    369:
    370:       # Initialize the default font families.
    371:     init_font_families
    372:
    373:       # Items formerly in EZWriter
    374:     @font_size = 10
    375:     @pageset = []
    376:
    377:     if paper.kind_of?(Array)
    378:       if paper.size == 4
    379:         size = paper # Coordinate Array
    380:       else
    381:         size = [0, 0, PDF::Writer.cm2pts(paper[0]), PDF::Writer.cm2pts(paper[1])]
    382:           # Paper size in centimeters has been passed
    383:       end
    384:     else
    385:       size = PAGE_SIZES[paper.upcase].dup
    386:     end
    387:     size[3], size[2] = size[2], size[3] if orientation == :landscape
    388:
    389:     @pages.media_box  = size
    390:
    391:     @page_width       = size[2] - size[0]
    392:     @page_height      = size[3] - size[1]
    393:     @y = @page_height
    394:
    395:       # Also set the margins to some reasonable defaults -- 1.27 cm, 36pt,
    396:       # or 0.5 inches.
    397:     margins_pt(36)
    398:
    399:       # Set the current writing position to the top of the first page
    400:     @y = absolute_top_margin
    401:       # Get the ID of the page that was created during the instantiation
    402:       # process.
    403:     @pageset[1] = @pages.first_page
    404:
    405:     fill_color!   Color::RGB::Black
    406:     stroke_color! Color::RGB::Black
    407:
    408:     yield self if block_given?
    409:   end