Class PDF::TechBook::TagTocDots
In: lib/pdf/techbook.rb
Parent: Object
TechBook Transaction::Simple SimpleTable Complex Action FontDescriptor Procset Catalog FontEncoding Pages Destination Info Encryption Annotation Contents Outline Page Outlines Font ViewerPreferences Image Hash OHash QuickRef StdDev FontMetrics StrokeStyle ARC4 PolygonPoint ImageInfo lib/pdf/simpletable.rb lib/pdf/writer.rb lib/pdf/techbook.rb lib/pdf/quickref.rb lib/pdf/charts/stddev.rb Charts Math lib/pdf/writer/ohash.rb lib/pdf/writer/fontmetrics.rb lib/pdf/writer/strokestyle.rb lib/pdf/writer/arc4.rb lib/pdf/writer/graphics.rb lib/pdf/writer/object.rb lib/pdf/writer/object/image.rb External lib/pdf/writer/object/font.rb lib/pdf/writer/object/outlines.rb lib/pdf/writer/object/contents.rb lib/pdf/writer/object/annotation.rb lib/pdf/writer/object/destination.rb lib/pdf/writer/object/viewerpreferences.rb lib/pdf/writer/object/info.rb lib/pdf/writer/object/fontencoding.rb lib/pdf/writer/object/page.rb lib/pdf/writer/object/catalog.rb lib/pdf/writer/object/outline.rb lib/pdf/writer/object/encryption.rb lib/pdf/writer/object/procset.rb lib/pdf/writer/object/action.rb lib/pdf/writer/object/pages.rb lib/pdf/writer/object/fontdescriptor.rb Object OffsetReader EN Lang lib/pdf/writer/graphics/imageinfo.rb Graphics Writer PDF dot/m_33_0.png

A stand-alone callback that draws a dotted line over to the right and appends a page number. The info[:params] will be like a standard XML tag with three named parameters:

level:The table of contents level that corresponds to a particular style. In the current TechBook implementation, there are only two levels. Level 1 uses a 16 point font and level1_style; level 2 uses a 12 point font and level2_style.
page:The page number that is to be printed.
xref:The target destination that will be used as a link.

All parameters are required.

Methods

[]  

Constants

DEFAULT_L1_STYLE = { :width => 1, :cap => :round, :dash => { :pattern => [ 1, 3 ], :phase => 1 }, :font_size => 16
DEFAULT_L2_STYLE = { :width => 1, :cap => :round, :dash => { :pattern => [ 1, 5 ], :phase => 1 }, :font_size => 12

Attributes

level1_style  [RW]  Controls the level 1 style.
level2_style  [RW]  Controls the level 2 style.

Public Class methods

[Source]

     # File lib/pdf/techbook.rb, line 312
312:       def [](pdf, info)
313:         if @level1_style.nil?
314:           @level1_style = sh = DEFAULT_L1_STYLE
315:           ss      = PDF::Writer::StrokeStyle.new(sh[:width])
316:           ss.cap  = sh[:cap] if sh[:cap]
317:           ss.dash = sh[:dash] if sh[:dash]
318:           @_level1_style = ss
319:         end
320:         if @level2_style.nil?
321:           @level2_style = sh = DEFAULT_L2_STYLE
322:           ss      = PDF::Writer::StrokeStyle.new(sh[:width])
323:           ss.cap  = sh[:cap] if sh[:cap]
324:           ss.dash = sh[:dash] if sh[:dash]
325:           @_level2_style = ss
326:         end
327: 
328:         level = info[:params]["level"]
329:         page  = info[:params]["page"]
330:         xref  = info[:params]["xref"]
331: 
332:         xpos = 520
333: 
334:         pdf.save_state
335:         case level
336:         when "1"
337:           pdf.stroke_style @_level1_style
338:           size = @level1_style[:font_size]
339:         when "2"
340:           pdf.stroke_style @_level2_style
341:           size = @level2_style[:font_size]
342:         end
343: 
344:         page = "<c:ilink dest='#{xref}'>#{page}</c:ilink>" if xref
345: 
346:         pdf.line(xpos, info[:y], info[:x] + 5, info[:y]).stroke
347:         pdf.restore_state
348:         pdf.add_text(xpos + 5, info[:y], page, size)
349:       end

[Validate]