From 8a07b7fb14f11204a0d840792ab9f4bd54b066e5 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Mon, 17 Oct 2016 17:13:32 +0200 Subject: Clean up link destination handling. All link destinations should be URIs, and a document specific function can be called to resolve them to actual page numbers. Outlines have cached page numbers as well as string URIs. --- include/mupdf/fitz/document.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'include/mupdf/fitz/document.h') diff --git a/include/mupdf/fitz/document.h b/include/mupdf/fitz/document.h index 7f3c8ece..d8123a00 100644 --- a/include/mupdf/fitz/document.h +++ b/include/mupdf/fitz/document.h @@ -32,6 +32,7 @@ typedef int (fz_document_authenticate_password_fn)(fz_context *ctx, fz_document typedef int (fz_document_has_permission_fn)(fz_context *ctx, fz_document *doc, fz_permission permission); typedef fz_outline *(fz_document_load_outline_fn)(fz_context *ctx, fz_document *doc); typedef void (fz_document_layout_fn)(fz_context *ctx, fz_document *doc, float w, float h, float em); +typedef int (fz_document_resolve_link_fn)(fz_context *ctx, fz_document *doc, const char *uri); typedef int (fz_document_count_pages_fn)(fz_context *ctx, fz_document *doc); typedef fz_page *(fz_document_load_page_fn)(fz_context *ctx, fz_document *doc, int number); typedef int (fz_document_lookup_metadata_fn)(fz_context *ctx, fz_document *doc, const char *key, char *buf, int size); @@ -87,6 +88,7 @@ struct fz_document_s fz_document_has_permission_fn *has_permission; fz_document_load_outline_fn *load_outline; fz_document_layout_fn *layout; + fz_document_resolve_link_fn *resolve_link; fz_document_count_pages_fn *count_pages; fz_document_load_page_fn *load_page; fz_document_lookup_metadata_fn *lookup_metadata; @@ -209,6 +211,13 @@ void fz_layout_document(fz_context *ctx, fz_document *doc, float w, float h, flo */ int fz_count_pages(fz_context *ctx, fz_document *doc); +/* + fz_resolve_link: Resolve an internal link to a page number. + + Returns -1 if the URI cannot be resolved. +*/ +int fz_resolve_link(fz_context *ctx, fz_document *doc, const char *uri); + /* fz_load_page: Load a page. -- cgit v1.2.3