Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self, parent_page):
self.parent_page = parent_page
self.pdf = parent_page.pdf
self.page_obj = parent_page.page_obj
self.page_number = parent_page.page_number
self.flush_cache(Container.cached_properties)
if type(parent_page) == Page:
self.root_page = parent_page
else:
self.root_page = parent_page.root_page
def pages(self):
if hasattr(self, "_pages"): return self._pages
doctop = 0
pp = self.pages_to_parse
self._pages = []
for i, page in enumerate(PDFPage.create_pages(self.doc)):
page_number = i+1
if pp != None and page_number not in pp: continue
p = Page(self, page, page_number=page_number, initial_doctop=doctop)
self._pages.append(p)
doctop += p.height
return self._pages
test_function
)
return self._objects
filtered = FilteredPage(self)
filtered.bbox = self.bbox
return filtered
def to_image(self, resolution=None):
"""
For conversion_kwargs, see http://docs.wand-py.org/en/latest/wand/image.html#wand.image.Image
"""
from .display import PageImage, DEFAULT_RESOLUTION
res = resolution or DEFAULT_RESOLUTION
return PageImage(self, resolution=res)
class DerivedPage(Page):
is_original = False
def __init__(self, parent_page):
self.parent_page = parent_page
self.pdf = parent_page.pdf
self.page_obj = parent_page.page_obj
self.page_number = parent_page.page_number
self.flush_cache(Container.cached_properties)
if type(parent_page) == Page:
self.root_page = parent_page
else:
self.root_page = parent_page.root_page