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 ability to customize PDF metadata for pdf-dc% #31

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

xeniarose
Copy link

This commit adds the ability to control the metadata fields for cairo's PDF output, using cairo_pdf_surface_set_metadata. The supported fields are title, author, subject, keywords, creator, create-date, and mod-date. properties have been added to ps-setup% (despite metadata being specific to PDF and not PostScript, but since pdf-dc% and post-script-dc% both share ps-setup% to control output parameters this seemed like the easiest choice, as opposed to adding a new PDF-specific setup class)
By default, all fields are initialized to #f, except creator which is initialized to: draw-lib (racket <version> https://racket-lang.org)

this commit adds the ability to control the metadata fields for cairo's
PDF output, using cairo_pdf_surface_set_metadata. the supported fields
are title, author, subject, keywords, creator, create-date, and
mod-date. properties have been added to ps-setup% (despite metadata
being specific to PDF and not PostScript, but since pdf-dc% and ps-dc%
both share ps-setup% to control output parameters this seemed like the
most natural choice)

by default, all fields are initialized to #f, except creator which is
initialized to:
"draw-lib (racket <version> https://racket-lang.org)"
@mflatt
Copy link
Member

mflatt commented Jan 26, 2021

It looks like cairo_pdf_surface_set_metadata was added in Cairo 1.15.10. That means it's not in the 1.14.12 builds that we distribute for Windows and Mac OS, and it wouldn't be in some Unix installations.

Maybe the right solution is to add a fallback for cairo_pdf_surface_set_metadata in "cairo.rkt" and tweak the documentation to say something like "where available".

@defmethod[(get-creator) (or/c string? #f)]{
Returns the creator metadata field, specifying the software that
created the document. By default, the creator is set to a string
specifying draw-lib and the current racket version.
Copy link
Member

Choose a reason for hiding this comment

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

Nit: I think "racket" should be capitalized here.

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