pymupdf / PyMuPDF

PyMuPDF is a high performance Python library for data extraction, analysis, conversion & manipulation of PDF (and other) documents.
https://pymupdf.readthedocs.io
GNU Affero General Public License v3.0
5.17k stars 495 forks source link

custom metadata keys #3528

Closed vorel99 closed 4 months ago

vorel99 commented 4 months ago

Hi, It would be nice to have option to add custom metadata keys to Document as following:

import fitz

doc = fitz.open(input path)
doc.set_metadata({
    "url": custom_url,
    "category": "article"
})

Right now, there are just following keys avalilable: /Creator, /Producer, /CreationDate, /ModDate, /Title, /Author, /Subject, /Trapped and /Keywords respectively. https://pymupdf.readthedocs.io/en/latest/document.html#Document.metadata

JorjMcKie commented 4 months ago

Already implemented! Please consult the documentation: https://pymupdf.readthedocs.io/en/latest/recipes-low-level-interfaces.html#how-to-extend-pdf-metadata