diff options
author | Simon Bünzli <zeniko@gmail.com> | 2013-09-25 17:54:43 +0200 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2013-09-27 17:09:47 +0100 |
commit | 5c1263c852f1357f1519007ea9d06449b1071ec3 (patch) | |
tree | 020a397926fb5431e15966615a950bccdaa8a44f | |
parent | ab567929dbbb62237e4598f9c1b6a8231431305c (diff) | |
download | mupdf-5c1263c852f1357f1519007ea9d06449b1071ec3.tar.xz |
tweak pdf_parse_action
* Destination names are a name and not a string
* Expose whether a /Launch action points to a path or a URI
-rw-r--r-- | include/mupdf/fitz/link.h | 3 | ||||
-rw-r--r-- | source/pdf/pdf-annot.c | 5 |
2 files changed, 5 insertions, 3 deletions
diff --git a/include/mupdf/fitz/link.h b/include/mupdf/fitz/link.h index 7a400851..47648a4c 100644 --- a/include/mupdf/fitz/link.h +++ b/include/mupdf/fitz/link.h @@ -91,6 +91,8 @@ enum { launch.new_window: If true, the destination should be launched in a new window. + launch.is_uri: If true, launch.file_spec is a URI to launch. + For FZ_LINK_NAMED: named.named: The named action to perform. Likely to be @@ -122,6 +124,7 @@ struct fz_link_dest_s { char *file_spec; int new_window; + int is_uri; } launch; struct diff --git a/source/pdf/pdf-annot.c b/source/pdf/pdf-annot.c index 4e3d1ca1..21cc00cc 100644 --- a/source/pdf/pdf-annot.c +++ b/source/pdf/pdf-annot.c @@ -264,8 +264,6 @@ pdf_parse_action(pdf_document *doc, pdf_obj *action) ld.kind = FZ_LINK_URI; ld.ld.uri.is_map = pdf_to_bool(pdf_dict_gets(action, "IsMap")); ld.ld.uri.uri = pdf_to_utf8(doc, pdf_dict_gets(action, "URI")); - ld.ld.gotor.file_spec = NULL; - ld.ld.gotor.new_window = 0; } else if (!strcmp(pdf_to_name(obj), "Launch")) { @@ -273,11 +271,12 @@ pdf_parse_action(pdf_document *doc, pdf_obj *action) file_spec = pdf_dict_gets(action, "F"); ld.ld.launch.file_spec = pdf_parse_file_spec(doc, file_spec); ld.ld.launch.new_window = pdf_to_int(pdf_dict_gets(action, "NewWindow")); + ld.ld.launch.is_uri = !strcmp(pdf_to_name(pdf_dict_gets(file_spec, "FS")), "URL"); } else if (!strcmp(pdf_to_name(obj), "Named")) { ld.kind = FZ_LINK_NAMED; - ld.ld.named.named = pdf_to_utf8(doc, pdf_dict_gets(action, "N")); + ld.ld.named.named = fz_strdup(ctx, pdf_to_name(pdf_dict_gets(action, "N"))); } else if (!strcmp(pdf_to_name(obj), "GoToR")) { |