diff options
author | Tor Andersson <tor@ccxvii.net> | 2017-02-02 15:55:40 +0100 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2017-02-06 17:10:40 +0100 |
commit | c100c4c77a88782ba5c4634994171db611952d44 (patch) | |
tree | 5dc9e03790f4eebd0586ed21510465ad8f831a85 /include | |
parent | 931f3d9a6c3ab0fbfa3e365fe040e1b86c47e9fc (diff) | |
download | mupdf-c100c4c77a88782ba5c4634994171db611952d44.tar.xz |
Add bookmarks so we can find a location after reflowing a document.
Diffstat (limited to 'include')
-rw-r--r-- | include/mupdf/fitz/document.h | 17 | ||||
-rw-r--r-- | include/mupdf/html.h | 2 |
2 files changed, 19 insertions, 0 deletions
diff --git a/include/mupdf/fitz/document.h b/include/mupdf/fitz/document.h index d7dbd447..c66dc2ca 100644 --- a/include/mupdf/fitz/document.h +++ b/include/mupdf/fitz/document.h @@ -16,6 +16,7 @@ typedef struct fz_document_s fz_document; typedef struct fz_document_handler_s fz_document_handler; typedef struct fz_page_s fz_page; typedef struct fz_annot_s fz_annot; +typedef intptr_t fz_bookmark; typedef enum { @@ -36,6 +37,8 @@ typedef int (fz_document_resolve_link_fn)(fz_context *ctx, fz_document *doc, con 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); +typedef fz_bookmark (fz_document_make_bookmark_fn)(fz_context *ctx, fz_document *doc, int page); +typedef int (fz_document_lookup_bookmark_fn)(fz_context *ctx, fz_document *doc, fz_bookmark mark); typedef fz_link *(fz_page_load_links_fn)(fz_context *ctx, fz_page *page); typedef fz_rect *(fz_page_bound_page_fn)(fz_context *ctx, fz_page *page, fz_rect *); @@ -100,6 +103,8 @@ 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_make_bookmark_fn *make_bookmark; + fz_document_lookup_bookmark_fn *lookup_bookmark; fz_document_resolve_link_fn *resolve_link; fz_document_count_pages_fn *count_pages; fz_document_load_page_fn *load_page; @@ -217,6 +222,18 @@ int fz_is_document_reflowable(fz_context *ctx, fz_document *doc); void fz_layout_document(fz_context *ctx, fz_document *doc, float w, float h, float em); /* + Create a bookmark for the given page, which can be used to find the + same location after the document has been laid out with different + parameters. +*/ +fz_bookmark fz_make_bookmark(fz_context *ctx, fz_document *doc, int page); + +/* + Find a bookmark and return its page number. +*/ +int fz_lookup_bookmark(fz_context *ctx, fz_document *doc, fz_bookmark mark); + +/* fz_count_pages: Return the number of pages in document May return 0 for documents with no pages. diff --git a/include/mupdf/html.h b/include/mupdf/html.h index be0808d1..e23a606d 100644 --- a/include/mupdf/html.h +++ b/include/mupdf/html.h @@ -283,5 +283,7 @@ void fz_draw_html(fz_context *ctx, fz_device *dev, const fz_matrix *ctm, fz_html float fz_find_html_target(fz_context *ctx, fz_html *html, const char *id); fz_link *fz_load_html_links(fz_context *ctx, fz_html *html, int page, const char *base_uri); void fz_drop_html(fz_context *ctx, fz_html *html); +fz_bookmark fz_make_html_bookmark(fz_context *ctx, fz_html *html, int page); +int fz_lookup_html_bookmark(fz_context *ctx, fz_html *html, fz_bookmark mark); #endif |