pdf-reader icon indicating copy to clipboard operation
pdf-reader copied to clipboard

What's meaning of the PDF::Reader::ObjectsHash's value {:A=>{:D=>"idp12280992", :S=>:GoTo}, :Border=>[0, 0, 0], :M=>"D:20130405144049-05'00'", :Rect=>[114.912, 554.40002, 127.872, 563.40002], :Subtype=>:Link, :Type=>:Annot}

Open zachary-wq opened this issue 11 years ago • 0 comments

This is my script:

#encoding: utf-8
require 'pdf/reader'

file_path = "/home/XXXXX/Downloads/PDF/AngularJS.pdf"

str = ""

def check_reader_reference par

  if par.class == PDF::Reader::Reference then
    par.id
  elsif par.class == Array then
    par.each_with_index do |par_arr, index|
      par[index] = check_reader_reference par_arr
    end
    par
  elsif par.class == Hash then
    par.each do |key, val|
      par[key] = check_reader_reference val
    end
    par
  else
    par
  end

end

PDF::Reader.open(file_path) do |reader|

  reader.objects.each do |k, v|
    puts "#{k.id}: #{check_reader_reference v}"
  end

end

when it runs , I got

2685: {:A=>{:D=>2700, :S=>:GoTo}, :C=>[0, 0, 0], :Parent=>2683, :Prev=>2698, :Title=>"Common Gotchas"}
2686: {:A=>{:D=>2697, :S=>:GoTo}, :C=>[0, 0, 0], :Next=>2683, :Parent=>2455, :Prev=>2687, :Title=>"Cookies"}
2687: {:A=>{:D=>2696, :S=>:GoTo}, :C=>[0, 0, 0], :Next=>2686, :Parent=>2455, :Prev=>2688, :Title=>"Communicating Between Scopes with $on, $emit, and $broadcast"}

what's meaning of this : ":A=>{:D=>2696, :S=>:GoTo}"

zachary-wq avatar Apr 29 '14 09:04 zachary-wq