【问题标题】:How to obtain the image with the differences when using diff-pdf-visually?使用 diff-pdf-visually 时如何获取有差异的图像?
【发布时间】:2022-01-03 15:52:21
【问题描述】:

我已经从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


    【解决方案1】:

    临时文件的消失是由可选的[--time TIME]变量控制的,如果设置不够高,可能已经被删除了。

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

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

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

    您需要注意两者,因为链式 poppler 和 imgmagick 构建了不同的工作集,更不用说 python 或任何 windows env 设置了。在搜索时,请参阅文档以将 --time 设置为 600 秒。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-12-01
      • 2023-03-13
      • 1970-01-01
      • 2017-04-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-07-04
      相关资源
      最近更新 更多