Class PDF::TechBook::TagXref
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 replacement callback that will return an internal link with either the name of the cross-reference or the page on which the cross-reference appears as the label. If the page number is not yet known (when the cross-referenced item has not yet been rendered, e.g., forward-references), the label will be used in any case.

The parameters are:

name:The name of the cross-reference.
label:Either page, title, or text. page will not be used for forward references; only title or text will be used.
text:Required if label has a value of text. Ignored if label is title, optional if label is page. This value will be used as the display text for the internal link. text takes precedence over title if label is page.

Methods

[]  

Public Class methods

[Source]

     # File lib/pdf/techbook.rb, line 249
249:     def self.[](pdf, params)
250:       name  = params["name"]
251:       item  = params["label"]
252:       text  = params["text"]
253: 
254:       xref = pdf.xref_table[name]
255:       if xref
256:         case item
257:         when 'page'
258:           label = xref[:page]
259:           if text.nil? or text.empty?
260:             label ||= xref[:title]
261:           else
262:             label ||= text
263:           end
264:         when 'title'
265:           label = xref[:title]
266:         when 'text'
267:           label = text
268:         end
269: 
270:         "<c:ilink dest='#{xref[:xref]}'>#{label}</c:ilink>"
271:       else
272:         warn PDF::Writer::Lang[:techbook_unknown_xref] % [ name ]
273:         PDF::Writer::Lang[:techbook_unknown_xref] % [ name ]
274:       end
275:     end

[Validate]