diff options
-rw-r--r-- | include/mupdf/pdf/document.h | 21 | ||||
-rw-r--r-- | source/pdf/pdf-portfolio.c | 16 | ||||
-rw-r--r-- | source/tools/pdfportfolio.c | 7 |
3 files changed, 16 insertions, 28 deletions
diff --git a/include/mupdf/pdf/document.h b/include/mupdf/pdf/document.h index 27e3d4f4..3a11787b 100644 --- a/include/mupdf/pdf/document.h +++ b/include/mupdf/pdf/document.h @@ -468,32 +468,21 @@ pdf_obj *pdf_portfolio_entry_info(fz_context *ctx, pdf_document *doc, int entry, name: The name to use for this entry (as used in the PDF name tree for the collection). - name_len: The byte length of name. - desc: The description to use for this entry (as used in the 'Desc' entry in the Collection entry). - desc_len: The byte length of desc. - filename: The filename to use for this entry (as used - in the 'F' entry in the collection entry). - - filename_len: The byte length of filename. - - unifilename: The filename to use for this entry (as used - in the 'UF' entry in the collection entry). - - unifilename_len: The byte length of unifilename. + in the 'F' and 'UF' entries in the collection entry). buf: The buffer containing the embedded file to add. Returns the entry number for this new entry. */ int pdf_add_portfolio_entry(fz_context *ctx, pdf_document *doc, - const char *name, int name_len, - const char *desc, int desc_len, - const char *filename, int filename_len, - const char *unifile, int unifile_len, fz_buffer *buf); + const char *name, + const char *desc, + const char *filename, + fz_buffer *buf); /* pdf_set_portfolio_entry_info: Set part of the entry diff --git a/source/pdf/pdf-portfolio.c b/source/pdf/pdf-portfolio.c index ca208734..74f9a34f 100644 --- a/source/pdf/pdf-portfolio.c +++ b/source/pdf/pdf-portfolio.c @@ -609,10 +609,10 @@ pdf_name_tree_insert(fz_context *ctx, pdf_document *doc, pdf_obj *tree, pdf_obj } int pdf_add_portfolio_entry(fz_context *ctx, pdf_document *doc, - const char *name, int name_len, - const char *desc, int desc_len, - const char *filename, int filename_len, - const char *unifile, int unifile_len, fz_buffer *buf) + const char *name, + const char *desc, + const char *filename, + fz_buffer *buf) { int len, entry = 0; pdf_obj *ef, *f, *params, *s; @@ -631,15 +631,15 @@ int pdf_add_portfolio_entry(fz_context *ctx, pdf_document *doc, if (doc->version < 17) doc->version = 17; - key = pdf_new_string(ctx, name, name_len); + key = pdf_new_text_string(ctx, name); fz_try(ctx) { val = pdf_new_dict(ctx, doc, 6); pdf_dict_put_dict(ctx, val, PDF_NAME(CI), 4); ef = pdf_dict_put_dict(ctx, val, PDF_NAME(EF), 4); - pdf_dict_put_string(ctx, val, PDF_NAME(F), filename, filename_len); - pdf_dict_put_string(ctx, val, PDF_NAME(UF), unifile, unifile_len); - pdf_dict_put_string(ctx, val, PDF_NAME(Desc), desc, desc_len); + pdf_dict_put_string(ctx, val, PDF_NAME(F), filename, strlen(filename)); + pdf_dict_put_text_string(ctx, val, PDF_NAME(UF), filename); + pdf_dict_put_text_string(ctx, val, PDF_NAME(Desc), desc); pdf_dict_put(ctx, val, PDF_NAME(Type), PDF_NAME(Filespec)); pdf_dict_put_drop(ctx, ef, PDF_NAME(F), (f = pdf_add_stream(ctx, doc, buf, NULL, 0))); len = fz_buffer_storage(ctx, buf, NULL); diff --git a/source/tools/pdfportfolio.c b/source/tools/pdfportfolio.c index beeeaf23..1ffa2242 100644 --- a/source/tools/pdfportfolio.c +++ b/source/tools/pdfportfolio.c @@ -186,10 +186,9 @@ pdfportfolio_add(int argc, char **argv) buf = fz_read_file(ctx, filename); pdf_add_portfolio_entry(ctx, doc, - ename, strlen(ename), /* name */ - ename, strlen(ename), /* desc */ - ename, strlen(ename), /* filename */ - ename, strlen(ename), /* unifile */ + ename, /* name */ + ename, /* desc */ + filename, /* filename */ buf); fz_drop_buffer(ctx, buf); } |