aboutsummaryrefslogtreecommitdiffstats
path: root/src/pdf_cnki.c
diff options
context:
space:
mode:
authoryzrh <yzrh@noema.org>2020-12-30 03:09:00 +0000
committeryzrh <yzrh@noema.org>2020-12-30 03:09:00 +0000
commit98691d4203f4e578b84b2014db0fbe0c1209cc48 (patch)
treec528e3ea964111b934ae5e61e847831d62944f41 /src/pdf_cnki.c
parent8d6fbb43c9bc840d4217bf4f0b49b1213f1601a1 (diff)
downloadmelon-98691d4203f4e578b84b2014db0fbe0c1209cc48.tar.gz
melon-98691d4203f4e578b84b2014db0fbe0c1209cc48.tar.zst
Add HN text extraction.
Diffstat (limited to 'src/pdf_cnki.c')
-rw-r--r--src/pdf_cnki.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/pdf_cnki.c b/src/pdf_cnki.c
index 16d5d64..d69797b 100644
--- a/src/pdf_cnki.c
+++ b/src/pdf_cnki.c
@@ -50,7 +50,7 @@ _outline(pdf_object_t **pdf, object_outline_tree_t **outline_tree, int id, int *
&size) == 0) {
strcat(dictionary, "/Title <feff");
- for (int i = 0; i < size; i++) {
+ for (int i = 0; i < size - 2; i++) {
snprintf(buf, 64, "%02x", (unsigned char) str[i]);
strcat(dictionary, buf);
}
@@ -89,7 +89,7 @@ _outline(pdf_object_t **pdf, object_outline_tree_t **outline_tree, int id, int *
}
/* Page starts from 0 */
- snprintf(buf, 64, "/Dest [%d /XYZ null null null]\n>>\n",
+ snprintf(buf, 64, "/Dest [%d /XYZ null null null]\n>>",
atoi(ptr->item->page) - 1);
strcat(dictionary, buf);
@@ -123,7 +123,7 @@ pdf_cnki_outline(pdf_object_t **pdf, object_outline_t **outline, int **ids)
free(outline_tree);
snprintf(buf, 128,
- "<<\n/Type Outlines\n/First %d 0 R\n/Last %d 0 R\n/Count %d\n>>\n",
+ "<<\n/Type Outlines\n/First %d 0 R\n/Last %d 0 R\n/Count %d\n>>",
ret[0], ret[1], ret[2]);
free(ret);