0

我正在尝试删除 pdf 页面内的表格,并尝试为此使用page.filter()函数,这里我有表格bbox 坐标 ,我试图比较对象坐标是否在表格坐标内。但我找不到过滤功能的任何示例用法。

这是文档链接

我尝试过这种方式:

def filter_func(object):
  #some logic to find the coordinates inside boundary or not

new_page = page.filter(lambda x: x if filter_func(x) else '')

但不幸的是,这种用法不起作用,请帮助了解如何使用 page.filter 功能

4

1 回答 1

1

发现这是有效的:

def filter_func(object):
 #some logic to find the coordinates inside boundary or not

new_page = page.filter(filter_func)

page.filter 是一个生成器,仅在您使用 new_page 时执行

于 2018-11-06T06:20:03.317 回答