使用 diff-pdf-visually 时如何获取有差异的图像?

问题描述 投票:0回答:2

我已经从 Github 安装了 diff-pdf-visually 工具,并在 Visual Studio Code 中使用它。

我用 python 运行了 2 个 PDF 文件:

from diff_pdf_visually import pdfdiff

pdfdiff("compareA.pdf", "compareB.pdf")

然后,我得到这个结果:

Converting each page of the PDFs to an image...
PDFs have the same number of pages. Checking each pair of converted images...
Min sig = 15.2909, significant?=True. The PDFs are different. The most different pages are: page 1 (sgf. 15.2909). 
False

但是,我无法找到包含视觉差异的文件。在 Github 页面上,提到有“临时文件”,其中包含一个 PNG 图像,每页都有差异。

如何找到具有视觉差异的文件以便使用它?

python github pdf compare
2个回答
1
投票

临时文件的消失由可选的[--time TIME]变量控制,因此如果设置不够高,当您查看时可能已被删除。

然而,最新的brew应该有一个额外的可选功能来将文件保存在给定的位置。不确定这是否是最新版本(可能不是)。

事实上,您使用的 VC 表明您使用的是 Windows,并且可能的位置是 %temp% 目录中的子文件夹,因此在运行比较时请注意,您应该在调用时看到一个新文件夹。

因此,它可能位于类似

C:\Users\your name\AppData\Local\Temp\diffpdfbzfxlraz
的位置,或者在运行时,某些 tmp 文件可能位于工作区中并构建为 /tmp/diffpdfhkhuea_s

您需要注意两者,因为链式 poppler 和 imgmagick 构建了不同的工作集,更不用说 python 或任何 Windows 环境设置了。请参阅文档了解 upping——搜索时需要 600 秒。


0
投票

使用命令行版本的 diff-pdf-visully 时,可以选择通过添加

-v
--verbose
来使用详细选项运行,这给了我临时目录的输出。我在 Mac 上,输出是

$ diff-pdf-visually -v --time 600
  Temporary directory: /var/folders/st/2t5c6z1s4cq9krgnchvqy9_40000gq/T/diffpdf25vocw6l
  Converting each page of the PDFs to an image...
  PDFs have same number of pages. Checking each pair of converted images...
- Page 1: significance=31.6028
- Page 2: significance=inf
Min sig = 31.6028, significant?=True. The PDFs are different. The most different pages are: page 1 (sgf. 31.6028).

虽然这不是您所描述的确切用法,但希望您的设置有类似的方法。

© www.soinside.com 2019 - 2024. All rights reserved.