2011-08-20 33 views

回答

5

我不知道的圖像,但使用Ruby pdfreader庫我是能夠成功地從一個大的PDF文件中提取註釋的最後一個版本:

PDF::Reader.open(filename) do |reader| 
    reader.pages.each do |page| 
    annots_ref = page.attributes[:Annots] 
    actual_annots = reader.objects[annots_ref] 
    if actual_annots && actual_annots.size > 0 
     actual_annots.each do |annot_ref| 
     actual_annot = reader.objects[annot_ref] 
      unless actual_annot[:Contents].nil? 
      puts "Page #{page.number},"+actual_annot[:Contents].inspect 
      end 
     end 
    end 
    end  
end 

我想,類似的東西可能完成提取圖像。