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 bindings for PDF tags #63

Open
tinchodias opened this issue Oct 15, 2024 · 1 comment
Open

Add bindings for PDF tags #63

tinchodias opened this issue Oct 15, 2024 · 1 comment

Comments

@tinchodias
Copy link
Contributor

tinchodias commented Oct 15, 2024

There is an API introduced in cairo v1.6.0 to add hyperlinks for a PDF surface. The bindings would be simple, and simple to use. See this example:

cairo_tag_begin (cr, CAIRO_TAG_LINK, "uri='https://cairographics.org'");
cairo_move_to (cr, 50, 50);
cairo_show_text (cr, "This is a link to the cairo website.");
cairo_tag_end (cr, CAIRO_TAG_LINK);

It is also possible to link to a local destination (in the same PDF), using another tag. More details on this API: https://www.cairographics.org/manual/cairo-Tags-and-Links.html

@tinchodias
Copy link
Contributor Author

Bindings would be, at the lowest-level, adding 2 methods to AeCairoContext:

tagBegin: tagName attributes: attributesAsString

	self ffiCall: #(
		void
		cairo_tag_begin (
			self,
			char *tagName,
			char *attributesAsString ))

and:

tagEnd: tagName

	self ffiCall: #(
		void
		cairo_tag_end (
			self,
			char *tagName ))

those tag names can be in a new class AeCairoTag with 4 class-side methods.

Additionally, other higher-level methods could translate Pharo objects arguments to the attributesAsString that tagBegin: expects.

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

No branches or pull requests

1 participant