Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add metadata feature #39

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

spechtx
Copy link

@spechtx spechtx commented Nov 16, 2024

Add PDF Metadata Support

This PR adds support for PDF metadata manipulation via Gotenberg's metadata API.

Features

  • Adds MetadataMixin for setting PDF metadata fields including:
    • Document information (title, author, subject, keywords)
    • Dates (creation, modification)
    • Technical details (pdf version, creator, producer)
    • PDF standards (trapped status, marked status)
  • Full validation of metadata values
  • Support for method chaining
  • Comprehensive test coverage

Example Usage

route.metadata(
    title="My Document",
    author="John Doe",
    creation_date=datetime.now(),
    keywords=["sample", "document"],
    subject="Sample PDF Generation"
).run()

Documentation

Added metadata examples to README.md
Added documentation for all metadata fields and options
Included PDF/A and metadata section in the documentation

Notes

The existing test failures are unrelated to this implementation (verified against main branch)
All metadata fields are optional
Values are properly validated before being sent to Gotenberg

Copy link
Owner

@stumpylog stumpylog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't looked at all the changes yet, but besides the linting so tests can run, I would like a few other changes:

  • It's great to see testing, but
    • Let's group tests into classes so it follows the same format as existing ones
    • Let's use some more end to end testing that actually goes through the client, and the result is read via pikepdf or similar to ensure it is applied
  • I think the "Trapped" should be more strongly typed than a string or bool, you've created the enum, so it seems good to use it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants