Metadata in the PDF object

Inspecting the PDF Root object

Open a PDF and see what is inside the /Root object.

 >>> example = Pdf.open('tests/resources/sandwich.pdf')
 >>> example.Root
 <pikepdf.Object.Dictionary({
  '/Metadata': pikepdf.Object.Stream(stream_dict={
      '/Length': 3308,
      '/Subtype': /XML,
      '/Type': /Metadata
  }, data=<...>),
  '/Pages': {
    '/Count': 1,
    '/Kids': [ {
      '/Contents': pikepdf.Object.Stream(stream_dict={
          '/Length': 44
        }, data=<...>),
      '/MediaBox': [ 0, 0, Decimal('545.2800'), Decimal('443.5200') ],
      '/Parent': <circular reference>,
      '/Resources': {
        '/XObject': {
          '/Im0': pikepdf.Object.Stream(stream_dict={
              '/BitsPerComponent': 8,
              '/ColorSpace': /DeviceRGB,
              '/Filter': [ /FlateDecode ],
              '/Height': 1848,
              '/Length': 291511,
              '/Subtype': /Image,
              '/Type': /XObject,
              '/Width': 2272
            }, data=<...>)
        }
      },
      '/Type': /Page
    } ],
    '/Type': /Pages
  },
  '/Type': /Catalog
})>

The /Root object is a PDF dictionary that describes where the rest of the PDF content is.