如何通过 pdftk 管道生成 pdf 输出以删除注释?
How do I pipe pdf-generating output through pdftk to remove annotations?
我想通过 pdftk 传输 pdf 生成输出以删除注释。
我怎样才能合并一个有效的 AppleScript 行的这个现有部分:
do shell script "/usr/local/bin/$pdf-generating-app --page-size=A4 --page-margin=5mm " & (quoted form of POSIX path of filename) & " -o " & (quoted form of POSIX path of outputFilename)
并根据 by Farid Cheraghi?
通过 pdftk 删除注释
sh pdftk in.pdf output - uncompress | sed '/^\/Annots/d' | pdftk - output out.pdf compress
如果是 YeLogic prince,您可以使用连字符 (-
) 使其输出到 stdout
,然后将其通过管道传输到 pdftk :
/usr/local/bin/prince --page-size=A4 --page-margin=5mm <your filename> -o - | \
pdftk - output - uncompress | sed '/^\/Annots/d' | pdftk - output out.pdf compress
对于 AppleScript,应该是:
do shell script "/usr/local/bin/prince --page-size=A4 --page-margin=5mm " & (quoted form of POSIX path of filename) & " -o - | pdftk - output - uncompress | sed '/^\/Annots/d' | pdftk - output " & (quoted form of POSIX path of outputFilename) & " compress"
总之,建议你直接用prince去除水印,通过CSS属性应该可以。
这是最终版本,主要由 Zilog80 编译,对我有用:
do shell script "/usr/local/bin/$pdf-generating-app --page-size=A4 --page-margin=5mm " & (quoted form of POSIX path of filename) & " -o - | /usr/local/bin/pdftk - output - uncompress | sed '/^\/Annots/d' | /usr/local/bin/pdftk - output " & (quoted form of POSIX path of outputFilename) & " compress"
我想通过 pdftk 传输 pdf 生成输出以删除注释。
我怎样才能合并一个有效的 AppleScript 行的这个现有部分:
do shell script "/usr/local/bin/$pdf-generating-app --page-size=A4 --page-margin=5mm " & (quoted form of POSIX path of filename) & " -o " & (quoted form of POSIX path of outputFilename)
并根据
sh pdftk in.pdf output - uncompress | sed '/^\/Annots/d' | pdftk - output out.pdf compress
如果是 YeLogic prince,您可以使用连字符 (-
) 使其输出到 stdout
,然后将其通过管道传输到 pdftk :
/usr/local/bin/prince --page-size=A4 --page-margin=5mm <your filename> -o - | \
pdftk - output - uncompress | sed '/^\/Annots/d' | pdftk - output out.pdf compress
对于 AppleScript,应该是:
do shell script "/usr/local/bin/prince --page-size=A4 --page-margin=5mm " & (quoted form of POSIX path of filename) & " -o - | pdftk - output - uncompress | sed '/^\/Annots/d' | pdftk - output " & (quoted form of POSIX path of outputFilename) & " compress"
总之,建议你直接用prince去除水印,通过CSS属性应该可以。
这是最终版本,主要由 Zilog80 编译,对我有用:
do shell script "/usr/local/bin/$pdf-generating-app --page-size=A4 --page-margin=5mm " & (quoted form of POSIX path of filename) & " -o - | /usr/local/bin/pdftk - output - uncompress | sed '/^\/Annots/d' | /usr/local/bin/pdftk - output " & (quoted form of POSIX path of outputFilename) & " compress"