在PDF的末尾添加空白页,该页面的页面数量较少

发布于 2025-02-12 04:47:00 字数 888 浏览 1 评论 0原文

我有两个PDF文件,我的问题是阅读两个PDF文件,并掩盖了图像文件。我想将空白页面添加到PDF的末尾,该页面的页面数量较少,以便两个PDF中的页面数量相同。我的问题是如何使用Python在PDF中比较和添加空白页面?任何关于此的指示都会有所帮助。

list_im = []
images = convert_from_path(r"/home/hp/PycharmProjects/DHT/pdf_comparison/pdf/project plan1-2.pdf")
for i in range(len(images)):
    min_shape = sorted([(np.sum(i.size), i.size) for i in images])[0][1]
    imgs_comb_1 = np.hstack((np.asarray(i.resize(min_shape)) for i in images))
    imgs_comb_1 = np.vstack((np.asarray(i.resize(min_shape)) for i in images))


images = convert_from_path(r"/home/hp/PycharmProjects/DHT/pdf_comparison/pdf/project plan1-1.pdf")
for i in range(len(images)):
    min_shape = sorted([(np.sum(i.size), i.size) for i in images])[0][1]
    imgs_comb_2 = np.hstack((np.asarray(i.resize(min_shape)) for i in images))
    imgs_comb_2 = np.vstack((np.asarray(i.resize(min_shape)) for i in images))

I have two PDF file,My problem is read two pdf file and covert to image file. I want to add blank pages to the end of the PDF which has less number of pages, so that the number of pages in both PDFs is same. My question is how to compare and add blank pages to the PDF using python? Any pointers on this would be helpful.

list_im = []
images = convert_from_path(r"/home/hp/PycharmProjects/DHT/pdf_comparison/pdf/project plan1-2.pdf")
for i in range(len(images)):
    min_shape = sorted([(np.sum(i.size), i.size) for i in images])[0][1]
    imgs_comb_1 = np.hstack((np.asarray(i.resize(min_shape)) for i in images))
    imgs_comb_1 = np.vstack((np.asarray(i.resize(min_shape)) for i in images))


images = convert_from_path(r"/home/hp/PycharmProjects/DHT/pdf_comparison/pdf/project plan1-1.pdf")
for i in range(len(images)):
    min_shape = sorted([(np.sum(i.size), i.size) for i in images])[0][1]
    imgs_comb_2 = np.hstack((np.asarray(i.resize(min_shape)) for i in images))
    imgs_comb_2 = np.vstack((np.asarray(i.resize(min_shape)) for i in images))

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文