正在寻找linux PDF库以从PDF中提取注释和图像

正在寻找linux PDF库以从PDF中提取注释和图像,pdf,Pdf,我正在寻找一个免费的库(Java/Ruby),可以在linux上运行,可以从PDF中提取图像和注释;类似于CGPDFDocument在OSX上的功能 谢谢 我不知道图像,但使用最新版本的ruby库,我成功地从一个大PDF文件中提取了注释: PDF::Reader.open(filename) do |reader| reader.pages.each do |page| annots_ref = page.attributes[:Annots] actual_annots =

我正在寻找一个免费的库(Java/Ruby),可以在linux上运行,可以从PDF中提取图像和注释;类似于CGPDFDocument在OSX上的功能


谢谢

我不知道图像,但使用最新版本的ruby库,我成功地从一个大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

我想可以做类似的事情来提取图像。

我不知道图像,但使用ruby库的最新版本,我能够成功地从一个大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
我想可以做类似的事情来提取图像