ruby – 将元数据添加到PDF

前端之家收集整理的这篇文章主要介绍了ruby – 将元数据添加到PDF前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我需要向使用 prawn创建的PDF添加元数据.稍后将提取元数据,可能是 pdf-reader.此元数据将包含内部文档编号和下游工具所需的其他信息.

将元数据与PDF的每个页面相关联将是方便的. The PDF specification声称我可以将每页私人数据存储在“页面字典”中.第14.5节规定:

A page-piece dictionary (PDF 1.3) may be used to hold private
conforming product data. The data may be associated with a page or
form XObject by means of the optional PieceInfo entry in the page
object (see Table 30) or form dictionary (see Table 95). Beginning
with PDF 1.4,private data may also be associated with the PDF
document by means of the PieceInfo entry in the document catalogue
(see Table 28).

如何用虾设置“页面字典”?我正在使用虾0.12.0.

如果那是不可能的,那么我怎样才能实现在页面级别或文档级别存储每个页面元数据的目标?

解决方法

你可以看看虾的来源

https://github.com/prawnpdf/prawn/commit/131082af5abb71d83de0e2005ecceaa829224904

info = { :Title => "Sample MetaDATA",:Author => "Me",:Subject => "Not Working",:CreationDate => Time.now }

@pdf = Prawn::Document.new(:template => filename,:info => info)
原文链接:https://www.f2er.com/ruby/270858.html

猜你在找的Ruby相关文章