我需要向使用
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)