# Extract PDF Metadata with PyMuPDF in Python

If you’re working with a PyMuPDF's Document object called `doc`, you can access its metadata with:

`metadata = doc.metadata`

PyMuPDF is a Python library for working with PDF files.

## What does doc.metadata mean?

`doc.metadata` contains additional information about the PDF document, rather than the PDF document’s main text.

It might contain information such as:

*   format
    
*   title
    
*   author
    
*   creator
    

## Store the metadata

```python
metadata = doc.metadata
```

This takes the metadata associated with `doc` and stores it in a variable called `metadata`.

## Print the metadata

```python
print(metadata)
```

This displays the metadata:

{'format': 'PDF 1.5', 'title': 'Artificial Intelligence (AI) ', 'author': 'PDF Python Hub', 'subject': 'An Overview of Artificial Intelligence, Machine Learning, Generative AI, Ethical Frameworks, and Future Outlook', 'keywords': 'Artificial Intelligence, AI, Machine Learning, Deep Learning, Generative AI, Large Language Models, AI Ethics', 'creator': 'Google Docs', 'producer': 'Skia/PDF m153 Google Docs Renderer', 'creationDate': "D:20260816101230+02'00'", 'modDate': "D:20260818145823+02'00'", 'trapped': '', 'encryption': None}

You can then access individual pieces of information:

```python
print(metadata["author"])

print(metadata["creationDate"])
```

## Complete Example

```python
metadata = doc.metadata

print(metadata)
```

* * *

## Open the notebook

Open the Google Colab notebook for this PDF mini-guide and run the code as you follow along.

\[[Open in Google Colab](https://colab.research.google.com/drive/1o4RDtnFuxvFDG8P_3u2YlRXHu3D1_i19?usp=sharing)\]

* * *

## More PDF Python Resources

Want to learn how to open a PDF file?

Check out this mini-guide:

[Open Your First PDF with PyMuPDF](https://payhip.com/PDFPythonHub/blog/news/open-your-first-pdf-with-pymupdf)
