Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
以符合标准的方式(使用exiftool?)在PDF中添加XMP许可信息_Pdf_Exiftool - Fatal编程技术网

以符合标准的方式(使用exiftool?)在PDF中添加XMP许可信息

以符合标准的方式(使用exiftool?)在PDF中添加XMP许可信息,pdf,exiftool,Pdf,Exiftool,(这最终是一个关于PDF标准的问题,嵌入XMP许可信息的问题以及exiftool执行此操作的行为是我提出此问题的原因。) 我刚刚尝试通过发出命令将许可信息嵌入到带有exiftool的(n未压缩)PDF中 exiftool -XMP-dc:Rights="CC BY 4.0" my.pdf 我正在寻找一种稳定可靠的方法(也适用于压缩PDF)来实现这一点,并希望像exiftool这样的标准工具将是一个不错的选择 生成的PDF仍然可以很好地打开,但是查看它的内容让我怀疑修改的exiftool是否真的

(这最终是一个关于PDF标准的问题,嵌入XMP许可信息的问题以及
exiftool
执行此操作的行为是我提出此问题的原因。)

我刚刚尝试通过发出命令将许可信息嵌入到带有
exiftool
的(n未压缩)PDF中

exiftool -XMP-dc:Rights="CC BY 4.0" my.pdf
我正在寻找一种稳定可靠的方法(也适用于压缩PDF)来实现这一点,并希望像
exiftool
这样的标准工具将是一个不错的选择

生成的PDF仍然可以很好地打开,但是查看它的内容让我怀疑修改的
exiftool
是否真的符合PDF标准

原始文件以

[...]
1017 0 obj
<< /Type /Catalog /Names 1016 0 R /OpenAction 105 0 R
/Outlines 973 0 R /PageMode /UseOutlines /Pages 972 0 R >>
endobj
[...]
trailer
<< /ID [ <9fe842ddcb590d8769ad14dc73cb68c4>
<a8e74b152bcd65822c59e4fc7a2e5103> ]
/Info 1018 0 R /Root 1017 0 R /Size 1022 >>
startxref
4377062
%%EOF
因此,生成的文件有两个
尾部
s,两次包含
%EOF
注释,甚至现在还包含两个对象编号为
1017的对象

我确实知道或了解PDF文件规范,并有这样的印象,即这违反了PDF标准,但与此同时,一个标准程序
exiftool
似乎不太可能造成如此明显的错误?希望对PDF标准和/或exiftool有更深入了解的人能对此发表评论。

事实证明(我不知道),PDF允许多个
预告片和覆盖对象。例如,这一点得到了很好的解释

[...]
1017 0 obj
<< /Type /Catalog /Names 1016 0 R /OpenAction 105 0 R
/Outlines 973 0 R /PageMode /UseOutlines /Pages 972 0 R >>
endobj
[...]
trailer
<< /ID [ <9fe842ddcb590d8769ad14dc73cb68c4>
<a8e74b152bcd65822c59e4fc7a2e5103> ]
/Info 1018 0 R /Root 1017 0 R /Size 1022 >>
startxref
4377062
%%EOF
%BeginExifToolUpdate      <------- Here exiftool starts appending
1017 0 obj                <------- This number was used before!
<<
/Type /Catalog
/Names 1016 0 R
/OpenAction 105 0 R
/Outlines 973 0 R
/PageMode /UseOutlines
/Pages 972 0 R
/Metadata 1022 0 R
>>
endobj
1022 0 obj
<<
/Type /Metadata
/Subtype /XML
/Length 2863
>>
stream
<?xpacket begin='' id='W5M0MpCehiHzreSzNTczkc9d'?>
    [Supposedly correct XMP representation of the licence information]                                                                                                    
<?xpacket end='w'?>
endstream
endobj
xref
0 1
0000000000 65535 f 
1017 1
0004397692 00000 n 
1022 1
0004397842 00000 n 
trailer
<<
/ID [ <9fe842ddcb590d8769ad14dc73cb68c4> <a9e74b152bcd65822c59e4fc7a2e5103> ]
/Info 1018 0 R
/Root 1017 0 R
/Size 1023
/Prev 4377062
>>
%EndExifToolUpdate 4397671
startxref
4400791
%%EOF