Change pdf.root to pdf.Root

This commit is contained in:
James R. Barlow 2020-11-03 01:30:31 -08:00
parent ced7ad9164
commit 3707af3b74
No known key found for this signature in database
GPG Key ID: E54A300D567E1260
3 changed files with 8 additions and 8 deletions

View File

@ -818,12 +818,12 @@ class PdfInfo:
check_pages=check_pages,
detailed_analysis=detailed_analysis,
)
self._needs_rendering = pdf.root.get('/NeedsRendering', False)
self._needs_rendering = pdf.Root.get('/NeedsRendering', False)
self._has_acroform = False
if '/AcroForm' in pdf.root:
if len(pdf.root.AcroForm.get('/Fields', [])) > 0:
if '/AcroForm' in pdf.Root:
if len(pdf.Root.AcroForm.get('/Fields', [])) > 0:
self._has_acroform = True
elif '/XFA' in pdf.root.AcroForm:
elif '/XFA' in pdf.Root.AcroForm:
self._has_acroform = True
@property

View File

@ -302,8 +302,8 @@ def test_kodak_toc(resources, outpdf):
p = pikepdf.open(outpdf)
if pikepdf.Name.First in p.root.Outlines:
assert isinstance(p.root.Outlines.First, pikepdf.Dictionary)
if pikepdf.Name.First in p.Root.Outlines:
assert isinstance(p.Root.Outlines.First, pikepdf.Dictionary)
def test_metadata_fixup_warning(resources, outdir, caplog):

View File

@ -137,9 +137,9 @@ def test_report_file_size(tmp_path, caplog):
caplog.clear()
waste_of_space = b'Dummy' * 5000
pdf.root.Dummy = waste_of_space
pdf.Root.Dummy = waste_of_space
pdf.save(in_)
pdf.root.Dummy2 = waste_of_space + waste_of_space
pdf.Root.Dummy2 = waste_of_space + waste_of_space
pdf.save(out)
with patch('ocrmypdf._validation.jbig2enc.available', return_value=True), patch(